EXIF (or other meta-data) data that Windows displays but PHP does not -


i working pull information jpegs supplied client photographer.

when examined under windows of images contain data in field called tags:

enter image description here

enter image description here

to testing first made following script , iterating on entries in binary file headers using code below.

sometimes values imagedescription. text in copyright , author tags content never ever shows here , capture of content client wants automate.

can advise me how can access tags field content?

uploaded copy of file here.

update - changed idf0 any_tag , added 3rd arg true exif_read_data() per tiger-222's response. added print_r output @ end of post

update 2 added requested error_display() , ini_set() calls , tried exif_read_data() 2nd arg of 0 in place of 'any_tag' per https://php.net/manual/en/function.exif-read-data.php

<?php     ini_set('display_errors', 1);     ini_set('exif.encode_unicode', 'utf-8');  // see winxp values     error_reporting(-1);             $n = (intval($_get['n'])) ? $_get['n'] : 99;     echo "ani_$n.jpg:<br />\n";     $exif = exif_read_data("ani_$n.jpg", 'any_tag', true);     echo $exif===false ? "no header data found.<br />\n" : "image contains following headers:<br><br />\n";      if ($exif) {         foreach ($exif $key => $section) {             if (is_array($section)) {                 foreach ($section $name => $val) {                     echo "$key.$name: $val<br />\n";                 }             } else {                 echo "$key: $section<br>\n";             }         }     } ?> 

the following content dumped script whooping crane image:

ani_69.jpg: image contains following headers:  filename: ani_69.jpg filedatetime: 1428255617 filesize: 2448245 filetype: 2 mimetype: image/jpeg sectionsfound: any_tag, ifd0, thumbnail, exif computed.html: width="1798" height="2697" computed.height: 2697 computed.width: 1798 computed.iscolor: 1 computed.byteordermotorola: 0 computed.copyright: photographer name here computed.thumbnail.filetype: 2 computed.thumbnail.mimetype: image/jpeg imagewidth: 1798 imagelength: 2697 bitspersample.0: 8 bitspersample.1: 8 bitspersample.2: 8 photometricinterpretation: 2 orientation: 1 samplesperpixel: 3 xresolution: 1000000/10000 yresolution: 1000000/10000 resolutionunit: 2 software: adobe photoshop cs6 (macintosh) datetime: 2014:12:28 19:17:36 artist: photographer name here copyright: photographer name here exif_ifd_pointer: 316 thumbnail.compression: 6 thumbnail.xresolution: 72/1 thumbnail.yresolution: 72/1 thumbnail.resolutionunit: 2 thumbnail.jpeginterchangeformat: 554 thumbnail.jpeginterchangeformatlength: 3211 exifversion: 0230 datetimeoriginal: 2014:11:03 11:14:27 datetimedigitized: 2014:11:03 11:14:27 subsectimeoriginal: 76 subsectimedigitized: 76 colorspace: 65535 exifimagewidth: 1798 exifimagelength: 2697 

here's dump of $exif $exif = exif_read_data("ani_$n.jpg", 'any_tag', true);

array (     [file] => array         (             [filename] => ani_69.jpg             [filedatetime] => 1428255617             [filesize] => 2448245             [filetype] => 2             [mimetype] => image/jpeg             [sectionsfound] => any_tag, ifd0, thumbnail, exif         )      [computed] => array         (             [html] => width="1798" height="2697"             [height] => 2697             [width] => 1798             [iscolor] => 1             [byteordermotorola] => 0             [copyright] => digital roux photography llc             [thumbnail.filetype] => 2             [thumbnail.mimetype] => image/jpeg         )      [ifd0] => array         (             [imagewidth] => 1798             [imagelength] => 2697             [bitspersample] => array                 (                     [0] => 8                     [1] => 8                     [2] => 8                 )              [photometricinterpretation] => 2             [orientation] => 1             [samplesperpixel] => 3             [xresolution] => 1000000/10000             [yresolution] => 1000000/10000             [resolutionunit] => 2             [software] => adobe photoshop cs6 (macintosh)             [datetime] => 2014:12:28 19:17:36             [artist] => digital roux photography llc             [copyright] => digital roux photography llc             [exif_ifd_pointer] => 316         )      [thumbnail] => array         (             [compression] => 6             [xresolution] => 72/1             [yresolution] => 72/1             [resolutionunit] => 2             [jpeginterchangeformat] => 554             [jpeginterchangeformatlength] => 3211         )      [exif] => array         (             [exifversion] => 0230             [datetimeoriginal] => 2014:11:03 11:14:27             [datetimedigitized] => 2014:11:03 11:14:27             [subsectimeoriginal] => 76             [subsectimedigitized] => 76             [colorspace] => 65535             [exifimagewidth] => 1798             [exifimagelength] => 2697         )  ) 

enter image description here

in three points (thanks jerrygarciuh patience , help).

1) see informations, pass third argument true:

$exif = exif_read_data("ani_$n.jpg", 'ifd0', true); 

as explained here, force conversion array avoid conflicts between sections. find tags under ifd0.keywords keyword.

2) there issue winxp.keywords. display correctly these informations, set encoding uft-8:

ini_set('exif.encode_unicode', 'utf-8'); 

3) this question ferdy, informations setted lightroom read using iptcparse. full script:

ini_set('exif.encode_unicode', 'utf-8');  // see winxp values  // exif informations -- limited php $exif = exif_read_data("ani_$n.jpg", 'any_tag', true); print_r($exif);  // additionnal informations lightroom getimagesize("ani_$n.jpg", $infos); if ( isset($infos['app13']) ) {     print_r(iptcparse($infos['app13'])); } 

output:

array (     [file] => array         (             [filename] => ani_69.or.jpg             [filedatetime] => 1431382165             [filesize] => 2450950             [filetype] => 2             [mimetype] => image/jpeg             [sectionsfound] => any_tag, ifd0, thumbnail, exif, winxp         )      [computed] => array         (             [html] => width="1798" height="2697"             [height] => 2697             [width] => 1798             [iscolor] => 1             [byteordermotorola] => 1             [copyright] => digital roux photography llc             [thumbnail.filetype] => 2             [thumbnail.mimetype] => image/jpeg         )      [ifd0] => array         (             [imagewidth] => 1798             [imagelength] => 2697             [bitspersample] => array                 (                     [0] => 8                     [1] => 8                     [2] => 8                 )              [photometricinterpretation] => 2             [imagedescription] => rusty costanza / digital roux photography             [orientation] => 1             [samplesperpixel] => 3             [xresolution] => 1000000/10000             [yresolution] => 1000000/10000             [resolutionunit] => 2             [software] => adobe photoshop cs6 (macintosh)             [datetime] => 2014:12:28 19:17:36             [artist] => digital roux photography llc             [copyright] => digital roux photography llc             [exif_ifd_pointer] => 2468             [title] => rusty costanza / digital roux photography             [keywords] => whooping crane             [undefinedtag:0xea1c] => �         )      [thumbnail] => array         (             [compression] => 6             [xresolution] => 72/1             [yresolution] => 72/1             [resolutionunit] => 2             [jpeginterchangeformat] => 4894             [jpeginterchangeformatlength] => 3371         )      [exif] => array         (             [exifversion] => 0230             [datetimeoriginal] => 2014:11:03 11:14:27             [datetimedigitized] => 2014:11:03 11:14:27             [subsectimeoriginal] => 76             [subsectimedigitized] => 76             [colorspace] => 65535             [exifimagewidth] => 1798             [exifimagelength] => 2697             [undefinedtag:0xea1c] => �         )      [winxp] => array         (             [title] => 刀甀猀琀礀 䌀漀猀琀愀渀稀愀 ⼀ 䐀椀最椀琀愀氀 刀漀甀砀 倀栀漀琀漀最爀愀瀀栀礀ഀ             [keywords] => 眀栀漀漀瀀椀渀最 挀爀愀渀攀         ) )  array (     [1#090] => array         (             [0] =>          )      [2#000] => array         (             [0] =>          )      [2#055] => array         (             [0] => 20141103         )      [2#060] => array         (             [0] => 111427+0000         )      [2#090] => array         (             [0] => new orleans         )      [2#025] => array         (             [0] => whooping crane         )      [2#080] => array         (             [0] => digital roux photography llc         )      [2#120] => array         (             [0] => rusty costanza / digital roux photography         )      [2#116] => array         (             [0] => digital roux photography llc         )      [2#221] => array         (             [0] => 0:0:0:-00001         )      [2#062] => array         (             [0] => 20141103         ) ) 

by way, nice picture ;)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -