Page 1 of 1

php and convert problem with some images

Posted: 2010-12-10T14:06:48-07:00
by ccristi77
Hi,
I have this img
https://docs.google.com/leaf?id=0B4Zy8e ... y=CI6I09MM

When calling from command bellow line is working ok.
convert a.jpg -resize 420x420 b.jpg

When calling via php
exec("convert a.jpg -resize 420x420 b.jpg") is not working. Is crashing with OutOfMemory

If I call from php
exec("convert a1.jpg -resize 420x420 b.jpg") and a1 is generated from command line with
convert a.jpg a1.jpg is working ok.

Can anyone tell me what is wrong with this image and also if there is a workaround for bellow issue to have same result with php ?

Thank You
Cristi

Re: php and convert problem with some images

Posted: 2010-12-10T19:20:40-07:00
by anthony
PHP is a different environment, with different command PATH, called in a different directory, and sometimes by a different user.

See IM Examples, APIs, PHP
http://www.imagemagick.org/Usage/api/#php

Re: php and convert problem with some images

Posted: 2010-12-12T02:52:20-07:00
by ccristi77
Hi,
Thank you for replay. I tried some new stuff I learned from the link you gave but still is not working.
Other images with same command, bigger or smaller than this are working, just few images are not working.
In php error log I see
"convert: Insufficient memory (case 4) `tarr.jpg'. convert: missing an image filename `tarr1.jpg'. "

Thank you,
Cristi

Re: php and convert problem with some images

Posted: 2010-12-12T04:51:00-07:00
by Bonzo
Why when I look at the image on your link using IE, firefox, chrome ( gave up with Safari as it would not even load the page ) is there just a blank page?
When I download it I can see it on my PC!

I can convert it OK using a localhost on my PC but again it will not show up in my browser but I can see it in the folder.

Code: Select all

<?php 
$array=array(); 
echo "<pre>";
system("identify -verbose a.jpg" );
exec("convert a.jpg -resize 420x420 b.jpg 2>&1", $array);  
echo "<br>".print_r($array)."<br>";  
echo "</pre>"; 
?>
<img src="b.jpg">
I would say that there is a problem with a the image and b your php setup.

Try running my code and see waht you get - compair the image information output with an image that is OK.