Exif Read Data - file not supported

Error log is filling up with the following message in MODX 3.0.3 and PHP 8.1…

[2023-03-24 11:33:37] (ERROR @ /var/www/vhosts/hos-tingdotcom/httpdocs/core/src/Revolution/Sources/modMediaSource.php : 2242) PHP warning: exif_read_data(my-image-name.png): File not supported
1 Like

Same thing happening for me, with same versions.
It doesn’t happen with all images, in my case the problem was with an old PNG, created with Adobe ImageReady (or at least that’s what was in meta).

1 Like

Have you guys implemented a solution at all ?

It’s happening to me too, on .webp images and the occasional .png as well.

I think I will need to fix it (even if it’s a hack) as I can’t allow the logs to get too bloated…

if you are asking for a solution, not to fill the the error log, you can try to set the systemsettings
log_level and debug to 0

1 Like

Thank you but I’d like to know if anyone has a solution to fix the actual error?

It’s not really an error, just a warning that gets logged.
It occurs here in the code:

Theoretically, the @ (the error control operator) in front of the function should suppress any errors.

You could add an if statement to the code, to only run exif_read_data for certain image types. There exists a variable $ext with the image extension.

A custom error handler could filter out these error messages, but it seems like overkill for the issue.

The logo for the CustomSearch extra causes this error message every time the page is loaded, yet the image looks fine. Is there some good reason that MODX is pulling exif information for every image, even though it’s likely that some images will cause this error message?

1 Like

The same problem. PHP warning: exif_read_data

It’s happening for me too…

It’s not just with old images. PNGs generated with current versions of Photoshop and Affinity software produce the same error. Images displayed on the front end don’t generate the error for me; it seems confined to viewing images in the Media Manager.

This would eliminate the error message for .png files, but I suspect it might cause other errors without some other changes to the code.:

if (strpos($absolute_path, '.png') === false) {
     $exif = @exif_read_data($absolute_path);

Has anyone figured out what’s causing this?

1 Like