|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-08-24 19:41 UTC] 7tonin at laposte dot net
Description: ------------ Hi, while trying to get EXIF thumbnail, some of my crafted pictures (Hugin, Gimp, Imagemagick, Exiftool) lead my webserver to two warnings: PHP Warning: exif_thumbnail(cloud.jpg): Illegal IFD size: 2 + 0x9D00*12 = 0x75C02 > 0x6D78 PHP Warning: exif_read_data(cloud.jpg): Illegal IFD size: 2 + 0x9D00*12 = 0x75C02 > 0x6D78 (this is the same size data for any picture) Another bad thing is file permissions are then changed to apache:apache Test script: --------------- try this file (uploaded twice for free) https://file.io/0J2TmIc9gNpR (1w expiry link) https://file.io/XFJoy5XoQtd0 Let's call it cloud.jpg <?php $stream = '/path/to/cloud.jpg' ; if ($exif = exif_read_data($stream, 0, true)) { echo "$stream :<br />\n"; foreach ($exif as $key => $section) { foreach ($section as $name => $val) { echo "$key.$name : $val<br />\n"; } } $thumbnail = exif_thumbnail($stream, $width, $height, $type); echo "<img width='$width' height='$height' src='data:image/gif;base64,".base64_encode($thumbnail)."'>"; } ?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 06:00:02 2025 UTC |
Sorry, when file.io is used for free, there is just one download available. That's pretty short. So I will send the image to anyone asking for. Work around, if you have got ImageMagick on the server, here is a fallback to fill $thumb_data : $thumb_data = exif_thumbnail($image_source_filename, $width, $height, $type) ; if ($thumb_data==false) { $return_var=null; $type='image/jpeg'; ob_start(); passthru('exiftool -b -thumbnailImage '.$image_source_filename, $return_var); $thumb_data = ob_get_contents(); ob_end_clean(); } This fallback shows ImageMagick is able to retrieve exif thumbnail.