PHP exif_read_data Illegal IFD size

前端 未结 5 1816
面向向阳花
面向向阳花 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:47

    you can catch an error with set_error_handler

    set_error_handler(function() {
      throw new Exception();
     }, E_WARNING);
    
      try{
         $exifData = exif_read_data($filePath);
      } catch (Exception $e) {
         $exifData = false;
      } finally {
         restore_error_handler();
      }
    
      if(!$exifData) {
         // do something
      }
    

提交回复
热议问题