Page 1 of 1

mogrify -draw text dont work , php exec

Posted: 2014-07-30T09:51:32-07:00
by urewelcome
I'm trying a couple of option to get mogrify -draw text to work but cant succeed.
Im using exec command on php.
Proviouse convert command work just fine, and also draw a circle work just fine, just cant get the text to work.
error code is outputed - only 1.

first try :

Code: Select all

exec("mogrify -gravity Center -font Arial -pointsize 100 -fill black -draw \"text 0,0 'Test Text'\" {$output}",$out,$err);
second try:

Code: Select all

$cmd = " -pointsize 400 -fill black ".  
	"-gravity south -draw \" text 0,0 'Draw text' \" ";  
	exec("mogrify $cmd {$output}",$out,$err); 

Re: mogrify -draw text dont work , php exec

Posted: 2014-07-30T10:30:40-07:00
by fmw42
your syntax for mogrify is incorrect. Mogrify has no specific output. It takes every image in a directory as represented by * (or some naming convention with * included) at the end and processes it. If you do not use the -path syntax, it will overwrite the input names.

try something like

change (cd) to the directory you want to work in that contains your images. then do

exec("mogrify -gravity Center -font Arial -pointsize 100 -fill black -draw \"text 0,0 'Test Text'\" *",$out,$err);

see
http://www.imagemagick.org/Usage/basics/#mogrify