ImageMagick cannot open/process files above 7mb on to solve?


I’ve succeeded in installing ImageMagick on my local computers and Imagick in both XAMPP and WAMP, and I can perform resizing operations on JPGs of any size on my localhost sites using Imagick.

PhpInfo.PHP on my DreamHost site shows ImageMagick 6.6.7-9 2014-03-06 and Imagick 3.2.0RC1 as the loaded module, with 206 formats supported, so everything seems to be fine.

However, if my live DreamHost site attempts to resize an image that’s approximately 7mbs or larger, it crashes. This is not the case when I run the same site on XAMPP or WAMP; I can resize images of any size (up to 128MB) on my localhosts.

This is not an uploading issue. I can upload JPGs to my DreamHost site without a hitch. It is also not a “timing out” issue, as I’ve tried turning off all time limits on operations as well as switching to standard CGI for the site. The crash happens precisely when an Imagick object attempts to open a JPG that’s approximately 7MB or larger.

Here is a sample (and very simple) script that illustrates the problem. When 1.JPG is less than ~7MB, the procedure is successful. When it’s circa 7MB or greater (I haven’t determined the exact size limitation yet), it can’t even create the Imagick object. This is not the case when running this code on my XAMPP and WAMP localhosts:

$source_image_file = “1.jpg”;
$source_image_path = $_SERVER[‘DOCUMENT_ROOT’] . “/” . $source_image_file;
$destination_image_file = “1-resized.jpg”;
$destination_image_path = $_SERVER[‘DOCUMENT_ROOT’] . “/” . $destination_image_file;

$im = new Imagick($source_image_path);
$im->resizeImage(528, null, Imagick::FILTER_LANCZOS2SHARP, 1);

Any help resolving this issue would be greatly appreciated.


Are you on shared hosting? Or a different dreamhost product?

I suspect your hitting a shared hosting limit.


I’ve been corresponding with the folks at ImageMagick and apparently this would correspond to a low value to the MAGIC_MEMORY_LIMIT in the ImageMagick policy.xml file. See the entry on MAGIC_MEMORY_LIMIT here:

Yes, I’m on a shared host, but the DreamHost Wiki explains how it’s possible to install a fresh (and more current) version of ImageMagick, which is not what is currently loaded, in your corner of a shared server, so it would seem that I should be able to get at the IM policy.xml file to check on that value and perhaps change it. Or perhaps a DreamHost admin could look into this.