Thumbnail creation fails for most of my images (but not all)

Hey,

I created a lot of pages and images via the REST API (about 330 pages). Now when I want to create smaller images in the template via crop() or resize(), it only works for a small fraction of my images (maybe 1/4th works and 3/4th fail).

In the media folder, I see the .jobs folder and the included json file for all the thumbs that failed to create – but no image file, e.g.:

{"width":32,"height":18,"quality":null,"crop":"center","filename":"small_screen-titel.jpg"}

I already increased PHP memory_ limit and execution_time to make sure it’s not a problem with one large image.

I think it might be a single corrupted image, that fails the whole process. Is there any way to debug this? PHP error log is empty :frowning:

Have you tried using ImageMagick instead of GD, if available?

How many images per frontend page are we talking about? Or are the affected images rather huge?

I haven’t tried Imagick, yet. But I found out something else:

Whether this problem occurs depends on my PHP environment. It happens locally on my Mac OS machine with MAMP and PHP 8. However, when I use Valet instead of MAMP, it does not happen and works fine. It also works fine on my webserver with PHP 7.4 and a LAMP image by Bitnami. So I probably won’t investigate any further and just use Valet locally.

I noticed this as well. Crop and resize both fail when running MAMP with PHP version 8. There are no errors but the file retains its original size. The issue happens when trying to crop a single normal size image so it doesn’t seem related to file size or dimensions.

When I reverted MAMP back to PHP 7.4 everything went smoothly.

<?=$site->ogimage()->toFile()->crop(1600,600)->url()?>