Page 1 of 1

Apache + php problem creating Shadows

Posted: 2010-10-10T09:58:00-07:00
by tomcontr
Hi,

Im having some problems with Apache each time I try to create thumbs with Shows.
This is the code:

Code: Select all

system("/usr/bin/convert $file1 -bordercolor white -border 6 -bordercolor grey60 -border 1 -background  black \( +clone -shadow 60x4+4+4 \)  +swap -background  none -flatten $file3");
If I execute that code from apache : ie. http://www.mywebsite.com/file.php
Nothing happens, no error message nothing. The file is not created. But if I execute that file.php from the command line, the file is created.

Now, I thought it might be a permision issue, but its wird, beause if I remove this part from the command: \( +clone -shadow 60x4+4+4 \) +swap
then the code works, so clearly I can execute convert from apache, it just that some of the options are allowed and in this case -shadow is not...

So the question is, Does anyone knows why that particular option can be affected being called from Apache?

Hope that some can help me.

Regards
Tomas

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T10:17:58-07:00
by fmw42
Possibly multiple version of IM (one too old)?

try

which convert

and see if you have more than one version and what they are

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T10:27:45-07:00
by Bonzo
As Fred says your version may be to old and there could be two different versions on the server; use this code to display the version number php is using and any errors that IM returns:

Code: Select all

<?php
echo "<pre>";
system("convert -version");  
echo "</pre>";

$array=array();
echo "<pre>";
system("/usr/bin/convert $file1 -bordercolor white -border 6 -bordercolor grey60 -border 1 -background  black \( +clone -shadow 60x4+4+4 \)  +swap -background  none -flatten $file3 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
?> 
Use this to see what vewrsion the comand line is using:

Code: Select all

convert -version

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T10:29:52-07:00
by tomcontr
There are 2, but they are the same.

-bash: /usr/local/bin/convert -version
Version: ImageMagick 6.2.8 02/25/09 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC

-bash: /usr/bin/convert -version
Version: ImageMagick 6.2.8 02/25/09 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T10:32:27-07:00
by tomcontr
Bonzo wrote:As Fred says your version may be to old and there could be two different versions on the server; use this code to display the version number php is using and any errors that IM returns:

Code: Select all

<?php
echo "<pre>";
system("convert -version");  
echo "</pre>";

$array=array();
echo "<pre>";
system("/usr/bin/convert $file1 -bordercolor white -border 6 -bordercolor grey60 -border 1 -background  black \( +clone -shadow 60x4+4+4 \)  +swap -background  none -flatten $file3 2>&1", $array); 
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
?> 
Use this to see what vewrsion the comand line is using:

Code: Select all

convert -version

here is the output of that:

Code: Select all

Version: ImageMagick 6.2.8 02/25/09 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC


/usr/bin/convert: Unrecognized option (+clone).
1
1

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T10:39:38-07:00
by Bonzo
What happens if you use convert rather than /usr/bin/convert

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T10:41:23-07:00
by tomcontr
it worked!.... wird... Thanks!!
Do you know why?

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T10:52:07-07:00
by Bonzo
I think you may have 3 versions of IM on the server ! I assume it is something to do with the paths; you were specifying the path where I presume plain convert uses a default.

Anyway here is a way to create the image without +clone:

Code: Select all

exec(" convert input.png -write mpr:image +delete ( mpr:image -background black -shadow 60x4+5+5 ) mpr:image -composite shadow.png ");

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T12:17:38-07:00
by tomcontr
Maybe I did something wrong and I thought it was working, but not. Using only the "convert" statement Im still getting the "convert: Unrecognized option".

I re checked and there is only 1 versión of IM installed....

Any idea?

Thanks

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T12:59:14-07:00
by Bonzo
If +clone is not supported you will either have to update or modify the example I posted above.

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T13:09:12-07:00
by fmw42
tomcontr wrote:Maybe I did something wrong and I thought it was working, but not. Using only the "convert" statement Im still getting the "convert: Unrecognized option".

I re checked and there is only 1 versión of IM installed....

Any idea?

Thanks

IM 6.2.8 is very old and may not have all the features you need or some may not be working well. That version is over 350 versions old! -shadow uses layers merge which was not introduced until 6.3.6-2 see http://www.imagemagick.org/Usage/blur/#shadow

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T14:55:32-07:00
by tomcontr
No clearly its not the version. If I execute the php file from the command line it works, and its the exact same version.

Could it be a library problem or something??

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T16:20:00-07:00
by tomcontr
I found the problem.... indeed there is an older version of IM. ImageMagick 5.5.6.
As its a Hosting server I cant do anything about it, so the only thing I can do is try to do the same shadow using that version. Is that posible? which commands should I use?

Thanks in advance.

Re: Apache + php problem creating Shadows

Posted: 2010-10-10T21:26:21-07:00
by anthony
IM v5 is dated back to 2002 it is next to imposible to do anything of real compexity with it

You have to read modify and save the image for EVERY operation

You have no shadow command, distort, variable blurs or other enhancments

and it has so many bugs that have been fixed over the years, including some very important security bugs.

I would suggest that you ask them to upgrade, even if it is just from a security point of view!!!!

Could two versions of IM exist on the host? Maybe you can select between them?

Re: Apache + php problem creating Shadows

Posted: 2010-10-11T09:51:12-07:00
by fmw42
If this is Godaddy, they have two version of IM (v5x and v6.2.8 ). I believe that v5 is at /usr/bin and v6 is at /usr/local/bin But I have had no success in getting them to upgrade at all.

You might try another ISP. I hear that Hostgator may be more inclined to upgrade or install a special version for you.