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
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
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:
} catch (Exception $E) {
$timestamp = 0;
}
if ($bases['pathIsRelative']) {
$absolute_path = $bases['pathAbsolute'] . $path;
} else {
$absolute_path = $path;
}
if (function_exists('exif_read_data')) {
$exif = @exif_read_data($absolute_path);
if (!empty($exif) && array_key_exists('Orientation', $exif) && $exif['Orientation'] >= 5) {
// This image was rotated
$new_width = $size['height'];
$new_height = $size['width'];
$size['width'] = $new_width;
$size['height'] = $new_height;
}
}
// get original image size for proportional scaling
if ($size['width'] > $size['height']) {
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.