PHP exif_read_data Illegal IFD size

前端 未结 5 1808
面向向阳花
面向向阳花 2021-02-18 22:45

I\'m working on an application where I fix orientation (if it is present) of jpeg files downloaded from an AWS bucket.

Here you can verify that this image has exif Rotat

5条回答
  •  终归单人心
    2021-02-18 23:34

    I've also encountered this problem using exif_get_data. I can handle images on my localhost (PHP v5.4.15) but on my web host (PHP v5.6.22) the error 'illegal IFD size' even though I'd tried the "@" ignore warning method. I found that on the web host (whether because of different version or installation), exif_get_data was actually throwing an exception rather than issuing a warning. I'm using the exif data to reorientate the picture if it's been rotated, so if the exif data is faulty or not present I just ignore it and do nothing, here's the code snippet:

         try {
            $exif = exif_read_data($filePath);
         }
         catch (Exception $exp) {
            $exif = false;
         }
         if ($exif){
            ...
         }
    

提交回复
热议问题