exif003.phpt 2.2 KB

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