craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.26k stars 633 forks source link

[4.x]: Image 'does not appear to be an image' #15782

Open ben-callaway opened 3 weeks ago

ben-callaway commented 3 weeks ago

What happened?

Description

Some of our user supplied images are throwing an error in Sentry.io, stating that the image does not have any dimensions (Asset xxxxx is missing its width or height). The image attached in an example. The erroring images tend to be large, this one being 20mb, 300dpi, 8256x5504. JPEG.

If you try to edit the image in the editor (crop, flip etc) it fails when saving.

CleanShot 2024-09-23 at 13 40 57@2x

Original image: https://ibb.co/FgtvBLy

Is it due to the size, or something in the image itself, meta, color profile etc?

Craft CMS version

4.10.8

PHP version

8.2.21

Operating system and version

No response

Database type and version

No response

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.1-32)

Installed plugins and versions

-

i-just commented 3 weeks ago

Hi, thanks for getting in touch!

This sounds a lot like https://github.com/craftcms/cms/issues/13884 and https://github.com/craftcms/cms/issues/13687.

The error you’re seeing can be thrown in the following two places: Raster.php#L172 and Raster.php#L186.

In the second case, there should be an additional warning in the logs. If you check the logs you should be able to get a hint as to why that error is being thrown.

You could also check the database to see if the width and height values are there for this particular asset.