php - EXIF Subject and Tags data unreadable -
i trying use "subject" , "tags" (the latter being called "keywords" in exif data believe) sections of exif data .jpg file generate html each image in folder.
however when dump exif data image values of both "tags" , "subject" are: ?????????.
<?php $imagename = "test.jpg"; $exif = read_exif_data($imagename,"winxp"); print_r($exif); foreach ($exif $key => $val) { if ($key === "subject") { print("key: ".$key." data:".$val); } }
results in:
array ( [filename] => test.jpg [filedatetime] => 1500976635 [filesize] => 331401 [filetype] => 2 [mimetype] => image/jpeg [sectionsfound] => any_tag, ifd0, exif, winxp [computed] => array ( [html] => width="1500" height="1100" [height] => 1100 [width] => 1500 [iscolor] => 1 [byteordermotorola] => 1 ) [imagedescription] => digicube left [exif_ifd_pointer] => 2110 [title] => ????????????? [keywords] => ?????????????? [subject] => ?????????? [undefinedtag:0xea1c] => � ) key: subject data:??????????
after reading of links google seems data in wrong format. changed code try , convert readable (which assume utf-8.)
after these changes, looks this.
<?php $imagename = "test.jpg"; $exif = read_exif_data($imagename,"winxp"); print_r($exif); mb_http_output('utf-8'); foreach ($exif $key => $val) { if ($key === "subject") { print("key: ".$key." data:".$val); mb_convert_encoding($val, 'utf-8', 'auto'); print("key: ".$key." data:".$val); } }
however results in same output:
key: subject data:??????????key: subject data:??????????
i have changed php.ini activate following line: mbstring.encoding_translation = on
what missing?
Comments
Post a Comment