php-image-resize icon indicating copy to clipboard operation
php-image-resize copied to clipboard

undefined finfo_open()

Open jenstornell opened this issue 6 years ago • 3 comments
trafficstars

In my PHP 7+ environments I get undefined finfo_open(). I guess a dll file is missing on my shared host. The function is there to check if the image is valid.

Suggested solution: Simply make a check if the function exists before using it.

For people with the same issue, here is a quickfix, just comment it out (around line 112).

/*$finfo = finfo_open(FILEINFO_MIME_TYPE);
if (strstr(finfo_file($finfo, $filename), 'image') === false) {
  throw new ImageResizeException('Unsupported file type');
}*/

jenstornell avatar May 22 '19 07:05 jenstornell

If we don't use the finfo extension to detect image type, the possible solutions are as follows:

  • Using the exif_imagetype to detect image type if the exif extension is loaded.
  • Using the fopen and fgets to get the magic binary to detect the image type.

The second solution I think it's another package because it's huge features.

peter279k avatar May 22 '19 07:05 peter279k

I think we should use exif_imagetype. It's better solution.

adityapatadia avatar Jun 07 '19 11:06 adityapatadia

@peter279k can we do something about this?

adityapatadia avatar Jul 04 '20 21:07 adityapatadia