mogrify -draw text dont work , php exec

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
urewelcome
Posts: 4
Joined: 2014-07-29T05:50:05-07:00
Authentication code: 6789

mogrify -draw text dont work , php exec

Post 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); 
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mogrify -draw text dont work , php exec

Post 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
Post Reply