I’m trying to convert a png image in PHP the following way:
exec($cmd, $output, $return_code);
Where $cmd contains the following line of code:
/usr/bin/convert 'images/original/Id1741.png' -thumbnail x200 -quality '90' './cache/a3b84c5931d9619d12a9e244a310cb17_h200.png'
Calling this code on the command line works perfectly fine, but executing it on the webserver gives me the following error message:
Tried to execute : convert 'images/original/Id1741.png' -thumbnail x200 -quality '90' './cache/a3b84c5931d9619d12a9e244a310cb17_h200.png', return code: 1, output: Array()
If I remove the thumbnail option the command executes just fine on the webserver, but oviously it does not resize anything. So it’s not a problem with permissions or the setup I guess.
PHP Version is 5.2.17.
ImageMagick Version is: 6.6.0-4 2012-04-26
Anyone ever had a similar issue and can help me with this?
Ok, I finally got it fixed. After redirecting stderr to a file I found the following error:
Seems that my hoster 1&1 recently upgraded the ImageMagick version which apparently uses more memory than the old one (at least that’s what the hoster says).
They recommend limiting the number of Threads created by ImageMagick:
I put this code into my init-script and now it works just fine!