I am working on a drupal 7 site http://imgmart.com where I have defined multiple image styles. I have a content type called gallery with image cck field. Everything works fine if I upload image of lower resolution like 800px (around 1 MB) file. When I upload larger resolution image, image style won't work but image file is getting uploaded successfully. I don't see any error reported in log file or log messages page.

What could be the issue?

  • Have you checked the permission for the image-style so created? Commented May 31, 2014 at 10:51
  • Yes I did, more over it is working for low resolution images. So I don't think it is permission issue.
    – mnm
    Commented Jun 1, 2014 at 12:05
  • Maybe you need to increase PHP memory limit
    – user34108
    Commented Jul 15, 2014 at 16:25

2 Answers 2


You are most likely hitting a PHP memory limit. When an image style tried to create a derivative image using the default GD library, the image is processed in the PHP thread and uses the PHP memory. The larger the image, the more memory the process will need. This would make sense why it works with smaller images, but not larger ones.

You could also just be running up against the timeout. The image process for the image could be taking longer then processes are allowed to run, but I'd bet on memory.

Another option is to switch to ImageMagick (https://www.drupal.org/project/imagemagick) to replace GD. I believe this takes the image processing out of the PHP process.

  • It's worth noting that ImageMagick is less well supported by many Drupal image modules than GD is, and may require a whole bunch of dependencies to be installed on the server. It has also had major security issues. It does hit memory errors less than GD, but I'd recommend keeping GD if possible (e.g. try my Max Image Size suggestion first and only resort to ImageMagick if nothing else works). Commented Jul 13, 2016 at 17:04

If you allow users to upload large images, you might run into this problem even after upping the PHP memory limit. If this happens, I strongly recommend installing this module: Max Image Size.

Suppose you allow users to upload 10mb image files straight from their digital camera, without forcing them to use image editing software.

  • Without Max Image Size module, the uncompressed image data for that massive file is held in memory and manipulated multiple times for each image style. That consumes a huge amount of memory. For many-megabyte "straight from camera" images that'll often exceed any memory limit you could or would want to place on a web server for one user's process.

  • With Max Image Size, there's a step before that honking great image reaches GD, cleanly scaling it down once to a large-but-reasonable size (2560x1600 by default, this setting can be changed). All the image style manipulations are then done to that image using much less memory.

This also has the effect of capping the largest possible size another user would get if they click an "original image" link. Very occasionally this might be a problem (e.g. if you're selling professional stock images and need the original monster-sized file - though even then it might be better to upload a raw or tiff file as an untouched plain download alongside the JPG), but usually it's a good thing too. If a user is on mobile data and clicks a full-size image link, they'll normally expect something like a high-quality 2560x1600 wallpaper, not some beast that takes minutes to load and wipes out a substantial chunk of their data allowance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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