Page 1 of 1

label not generating

Posted: 2012-04-23T09:42:56-07:00
by mahadazad
hi,
I am trying to generate text with rotation, no background color, and not defining the size. The command which i am using is working fine on my windows machine:

C:/im/convert -background none label:"fsdfds" -fill #ff0000 -font Arial -pointsize 12 C:/public_html/text.png

but the same command on my server which is on linux is not working (not generating any image):
/usr/bin/convert -background none label:"fsdfds" -fill #ff0000 -font Arial -pointsize 12 /home/public_html/text.png

not even this:
/usr/bin/convert label:"fsdfds" -fill #ff0000 -font Arial -pointsize 12 /home/public_html/text.png
/usr/bin/convert -background none label:"fsdfds" -font Arial -pointsize 12 /home/public_html/text.png

but however this works:
/usr/bin/convert label:"fsdfds" -font Arial -pointsize 12 /home/public_html/text.png


I have referred the documentation the syntax is correct but i cant figureout the reason of its failure. I can not see any error messages as i am using PHP to use this command as a system call, and it does not give any errors.

please help

thank you

Re: label not generating

Posted: 2012-04-23T10:16:01-07:00
by fmw42
specify all the settings before the label:

convert -background none -fill #ff0000 -font Arial -pointsize 12 label:"fsdfds" C:/public_html/text.png

In many cases IM processes from left to right, so settings need to be specified before the command.

Re: label not generating

Posted: 2012-04-24T02:28:39-07:00
by mahadazad
ok i tried this but did not work as well:

/usr/bin/convert -background none -fill #ff0000 -font Arial -pointsize 12 label:"fsdfds" /home/public_html/svg/text.png

Re: label not generating

Posted: 2012-04-24T02:36:14-07:00
by Bonzo
Try this to see if you get any errors:

Code: Select all

<?php
$array=array(); 
echo "<pre>"; 
exec("/usr/bin/convert -background none -fill #ff0000 -font Arial -pointsize 12 label:"fsdfds" /home/public_html/svg/text.png 2>&1", $array);  
echo "<br>".print_r($array)."<br>";  
echo "</pre>"; 
?>

Re: label not generating

Posted: 2012-04-24T02:59:44-07:00
by mahadazad
empty array

array ()

Re: label not generating

Posted: 2012-04-24T04:35:36-07:00
by Bonzo
Just seen an error in my code as I should have escaped the " around the text:

Code: Select all

<?php
$array=array(); 
echo "<pre>"; 
exec("/usr/bin/convert -background none -fill #ff0000 -font Arial -pointsize 12 label:\"fsdfds\" /home/public_html/svg/text.png 2>&1", $array);  
echo "<br>".print_r($array)."<br>";  
echo "</pre>"; 
?>
Its strange you are not getting and error; I will have to try it when I get home.

Re: label not generating

Posted: 2012-04-24T05:15:10-07:00
by mahadazad
ya i escaped at my side. But i dont know why i am getting an empty array and its not generating anything if i put '-background none -fill #ff0000'

Re: label not generating

Posted: 2012-04-24T07:41:18-07:00
by mahadazad
ok i fixed the problem myself. the problem was with fill I had to put it in quotes like "#ff0000"

so its working now:

/usr/bin/convert -background none label:"hello" -fill "#ff0000" -font Arial -pointsize 12 /home/public_html/text.png

Re: label not generating

Posted: 2012-04-26T18:00:17-07:00
by anthony
Remember when PHP executes a string....

PHP does its quotes, backslash and variable substitutions

Shell then splits up arguments and does its own variable and quote substitutions
and also does the "2>&1" file descriptor redirections (so PHP can read the errors on stdout)

ImageMagick gets a argument array, but will also do its own filename meta-character handling
specifically for DOS (the dos environment doesn't handle meta-chars) and for arguments such as
coder:*.gif[50x50] which the shell fails to expand due to coder: prefix or the [...] read modifier.

That is a LOT of argument parsing!

See IM examples PHP Shell
http://www.imagemagick.org/Usage/api/#php_example