Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.84k stars 1.5k forks source link

Gif Allowed memory size exhausted #1305

Closed mpn7 closed 6 months ago

mpn7 commented 6 months ago

I'm using your package to upload and edit images the user submits to the server, when the user submits a GIF file it gives the error Allowed memory size of 134217728 bytes exhausted I changed the memory limit to 256MB and it still throws this error. The GIF file has 6MB. I'm upgrading from the version 2, while it didn't keep the animation it also didn't throw this error.

The error happens in this line. The driver is GD

$manager = new ImageManager(new Driver());
$resized_image = $manager->read($image->getRealPath());
olivervogel commented 6 months ago

Unfortunately, the GD Library is not really easy on the resources. This is especially true for animated GIFs, as animation is not natively supported and therefore has to be decoded frame by frame into a GDImage instance by this library.

Unfortunately, I have to advise you to increase the limit further or to switch to Imagick driver.

olivervogel commented 6 months ago

This topic gave me the following idea, which will be dealt with further in a separate issue (#1307).