I was working on my site when I suddenly got this error from CE-Image

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 9940 bytes) in ................./system/expressionengine/third_party/ce_img/libraries/Ce_image.php on line 2834

I looked at the line and I saw this

$dest = imagecreatetruecolor( $this->width_final, $this->height_final );

Seems to me this is a memory error issue.

What steps should I do to correct this? Is this the fault of the plugin or PHP?

  • "Is this the fault of the plugin or PHP?" ...or User? If it is that the original image is too large as @noregt answered, try limiting the maximum filesize allowed for uploads in the File Upload Preferences to prevent users from uploading huge images. Aug 24 '13 at 7:54
  • @PeterLewis Yeah I was wondering if I can do something in the code to fix. But yeah, it is most likely a very big image or some wrong arguments to ce-image Aug 24 '13 at 8:08

PHP is letting you know that the maximum amount of memory that it is allowed to use has been exhausted. You need to either do less memory intensive things (work with smaller images, etc), or increase the maximum amount of memory PHP is allowed to use on your server.

When working with really large images, or even doing processor intensive filters on moderately large images, you'll need to increase the maximum amount of memory that PHP can access on your server. You can easily do so in php.ini or right in your EE config.php file like so:

$config['ce_image_memory_limit'] = 128;

The default limit is 64 (megabytes), so you can try bumping it up a bit. See the CE Image Basic Configuration page for more details on the config setting.

Another thing to keep in mind, is that CE Image is not the only thing that is using memory. The memory usage is comprised of all resources that PHP has in memory: files, snippets, add-on classes, etc. Image manipulation is innately memory heavy though.

Disclaimer: I'm the author of CE Image.


Did you take a look at the original size of the image? Especially the pixel width and height. If above, say, 2000 pixels it might be to much for 64MB memory on your server. If so, use a smaller image or get a bigger buffer on the server. But a full 36 Megapixel image is a challenge for any server/script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.