Bug #80016 [Com]: PHP Warning: exif_thumbnail: Illegal IFD size

From: Date: Thu, 27 Aug 2020 09:01:49 +0000
Subject: Bug #80016 [Com]: PHP Warning: exif_thumbnail: Illegal IFD size
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228767@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80016&edit=1

 ID:                 80016
 Comment by:         7tonin at laposte dot net
 Reported by:        7tonin at laposte dot net
 Summary:            PHP Warning:  exif_thumbnail: Illegal IFD size
 Status:             Verified
 Type:               Bug
 Package:            EXIF related
 Operating System:   linux 5.7.14-desktop-1.mga7 x86
 PHP Version:        7.3.21
 Block user comment: N
 Private report:     N

 New Comment:

Nice, thank you

Minor comments
- about "Another bad thing is file permissions are then changed to apache:apache"
It's because my script run by apache tries to rebuild such thumbnails. Apologize.
- about "Work around, if you have got ImageMagick on the server, here is a fallback".
Please change "$type='image/jpeg';" with
 $type=IMAGETYPE_JPEG;


Previous Comments:
------------------------------------------------------------------------
[2020-08-27 07:52:31] cmb@php.net

Actually, I did receive your email; maybe I just missed it
the other day.

Anyhow, with latest PHP-7.3 I don't get "Illegal IFD size"
warnings, but rather "corrupt EXIF header: maximum directory
nesting level reached" warnings.  There is a PR[1] which would fix
these.

[1] <https://github.com/php/php-src/pull/5976>

------------------------------------------------------------------------
[2020-08-26 21:27:06] cmb@php.net

Thanks, but that mail didn't went through.  Not sure what to do.

------------------------------------------------------------------------
[2020-08-26 17:30:27] 7tonin at laposte dot net

I did at [2020-08-26 16:03 UTC]

------------------------------------------------------------------------
[2020-08-26 16:40:02] cmb@php.net

Could you send the image to me, please?

------------------------------------------------------------------------
[2020-08-26 16:10:19] 7tonin at laposte dot net

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.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=80016


--
Edit this bug report at https://bugs.php.net/bug.php?id=80016&edit=1


Thread (9 messages)

« previous php.bugs (#228767) next »