Page 1 of 1

Cannot add text to my image

Posted: 2014-12-14T14:15:06-07:00
by donslund
I cannot add text to my image.

This works fine, it draws the bezier.
exec("convert julekort/".$row["image"].".jpg -draw 'bezier 70,50 95,100 95,0 120,50' flower_annotate1.jpg");

But this writes no text
exec("convert julekort/".$row["image"].".jpg -draw \"text 100,100 'Works like magick!' \" flower_annotate1.jpg");

I have also tried to use annotate with no luck.

Could the host have blocked for working with text?

Re: Cannot add text to my image

Posted: 2014-12-14T15:18:15-07:00
by Bonzo
The text might be off your image; try this:

Code: Select all

exec("convert julekort/".$row["image"].".jpg -gravity center -draw \"text 0,0 'Works like magick!' \" flower_annotate1.jpg"); 

Re: Cannot add text to my image

Posted: 2014-12-14T15:38:18-07:00
by donslund
Sorry, still no text. I suppose this should put the text right in the middle og the image. I only get the Background-image.

Re: Cannot add text to my image

Posted: 2014-12-14T15:55:51-07:00
by fmw42
try with just one specific image hard coded in the command. perhaps it relates to your code for extracting the correct image or somewhere else in your code

try removing the space between the single and escaped double quote, though I would not expect that to be an issue.

Code: Select all

magick!' \" 
also try escaping the !

Code: Select all

magick\!'\" 

Re: Cannot add text to my image

Posted: 2014-12-14T16:24:44-07:00
by snibgo
I would first try an example with no spaces or punctuation. Then you (probably) don't need quotes or escapes in the string. Like this, at the command line:

Code: Select all

convert -size 100x100 xc: -draw "text 50,50 hello" h.png

Re: Cannot add text to my image

Posted: 2014-12-15T00:01:20-07:00
by donslund
exec("convert -size 100x100 xc: -draw 'text 50,50 hello' h.png"); just gives me a white image size 100x100px. So the text part doesn't work, ata least not on my server.

Re: Cannot add text to my image

Posted: 2014-12-15T00:32:07-07:00
by fmw42
What version of IM are you using and on what platform? Perhaps it is time for an upgrade. Your version may have a bug?

Re: Cannot add text to my image

Posted: 2014-12-15T01:16:40-07:00
by donslund
ImageMagick 6.6.7-1 2011-01-17

PHP Version 5.3.8

Re: Cannot add text to my image

Posted: 2014-12-15T02:32:44-07:00
by donslund
I tested on another server with af slightly newer ImageMagisk, and there it works. I will move the files.

Thanks.