ImageMagick not working completely in PHP (only from shell)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
SEO

ImageMagick not working completely in PHP (only from shell)

Post by SEO »

Dear ImageMagick,

I am trying to use imagemagick from PHP, but I haven't been really succesful for half a year already. Some commands simply do not work. Others do. From shell (SSH) all command work, safe mode is disabled, magic quotes are off.

Today I upgraded to the latest version 6.4.3.10, and still it does not work for example with the following command:

exec(" convert -size 50x80 xc: +noise Random -write mpr:rand -extent 100x80 -page +50-40 mpr:rand -page +50+40 mpr:rand -flatten __FULL_PATH__/pc_tmp/hextile.jpg ")

What could be the problem?

Thanks in advance for your help.

Best Regards,
SEO
SEO

Re: ImageMagick not working completely in PHP (only from shell)

Post by SEO »

This is the error: convert: UnrecognizedNoiseType `Random'.

In shell however, this error is not returned and the command is processed fine.

exec(" convert -size 50x80 xc: +noise Random -write mpr:rand -extent 100x80 -page +50-40 mpr:rand -page +50+40 mpr:rand -flatten __FULL_PATH__/pc_tmp/hextile.jpg ")
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImageMagick not working completely in PHP (only from shell)

Post by Bonzo »

You could have two versions installed.

Try convert -version in shell and run this php code:

Code: Select all

<?php
system("convert -version");  
?> 
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick not working completely in PHP (only from shell)

Post by fmw42 »

I am not a PHP IM person and admit that I am puzzled by your command as I cannot figure out what you are trying to do. You seem to be writing to the same mpr: image over and over. I would have expected that you would be writing each change to a different mpr: image, e.g. mpr:rand1, mpr:rand2, mpr:rand3 etc and then flattening your images. Perhaps you can explain what you are trying to do.

If you are trying to get different random patterns, you can use -seed to change the seed value for the random number generation.

Also perhaps Random is being misinterpreted by the exec or PHP as a shell operation and not an IM function????
I don't know if this is relevant, but try 'Random' with quotes???
SEO

Re: ImageMagick not working completely in PHP (only from shell)

Post by SEO »

Hi there!

Thank you for your replies.
Also perhaps Random is being misinterpreted by the exec or PHP as a shell operation and not an IM function????
I don't know if this is relevant, but try 'Random' with quotes???
This is just a standard IM command I found in the usage documentation (see image), it also does not work with simple label:'text' commands. However, resizing would work, just not with the latest flags.

Image

http://www.imagemagick.org/Usage/backgrounds/
You could have two versions installed.
Yes, you were right. It returned: Version: ImageMagick 6.3.3 04/19/07 Q16 file:///usr/share/doc/ImageMagick-6.3.3/index.html Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

I will have my host take a look at it.

Thanks a lot for the support!

Best Regards,
Jan Jaap
Post Reply