exif003.phpt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. --TEST--
  2. Check for exif_read_data, Unicode user comment
  3. --EXTENSIONS--
  4. exif
  5. mbstring
  6. --SKIPIF--
  7. <?php
  8. if (!defined("EXIF_USE_MBSTRING") || !EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl');
  9. ?>
  10. --INI--
  11. output_handler=
  12. zlib.output_compression=0
  13. exif.decode_unicode_motorola=UCS-2BE
  14. exif.encode_unicode=ISO-8859-15
  15. --FILE--
  16. <?php
  17. /*
  18. test1.jpg is a 1*1 image that does not contain any Exif/Comment information
  19. test2.jpg is the same image but contains Exif/Comment information and a
  20. copy of test1.jpg as a thumbnail.
  21. test3.jpg is the same as test2.jpg but with a UNICODE UserComment: &Auml;&Ouml;&&Uuml;&szlig;&auml;&ouml;&uuml;
  22. */
  23. var_dump(exif_read_data(__DIR__.'/test3.jpg','',true,false));
  24. ?>
  25. --EXPECTF--
  26. array(5) {
  27. ["FILE"]=>
  28. array(6) {
  29. ["FileName"]=>
  30. string(9) "test3.jpg"
  31. ["FileDateTime"]=>
  32. int(%s)
  33. ["FileSize"]=>
  34. int(1240)
  35. ["FileType"]=>
  36. int(2)
  37. ["MimeType"]=>
  38. string(10) "image/jpeg"
  39. ["SectionsFound"]=>
  40. string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
  41. }
  42. ["COMPUTED"]=>
  43. array(12) {
  44. ["html"]=>
  45. string(20) "width="1" height="1""
  46. ["Height"]=>
  47. int(1)
  48. ["Width"]=>
  49. int(1)
  50. ["IsColor"]=>
  51. int(1)
  52. ["ByteOrderMotorola"]=>
  53. int(1)
  54. ["UserComment"]=>
  55. string(7) "ÄÖÜßäöü"
  56. ["UserCommentEncoding"]=>
  57. string(7) "UNICODE"
  58. ["Copyright"]=>
  59. string(41) "Photo (c) M.Boerger, Edited by M.Boerger."
  60. ["Copyright.Photographer"]=>
  61. string(19) "Photo (c) M.Boerger"
  62. ["Copyright.Editor"]=>
  63. string(20) "Edited by M.Boerger."
  64. ["Thumbnail.FileType"]=>
  65. int(2)
  66. ["Thumbnail.MimeType"]=>
  67. string(10) "image/jpeg"
  68. }
  69. ["IFD0"]=>
  70. array(2) {
  71. ["Copyright"]=>
  72. string(19) "Photo (c) M.Boerger"
  73. ["UserComment"]=>
  74. string(7) "UNICODE"
  75. }
  76. ["THUMBNAIL"]=>
  77. array(2) {
  78. ["JPEGInterchangeFormat"]=>
  79. int(134)
  80. ["JPEGInterchangeFormatLength"]=>
  81. int(523)
  82. }
  83. ["COMMENT"]=>
  84. array(3) {
  85. [0]=>
  86. string(11) "Comment #1."
  87. [1]=>
  88. string(11) "Comment #2."
  89. [2]=>
  90. string(13) "Comment #3end"
  91. }
  92. }