Page 1 of 1

Another text watermark question

Posted: 2006-05-20T08:18:52-07:00
by Bonzo
Hello

I used ImageMagick about 3-4 years ago but stopped when my host introduced Safe mode. I really want to start using it again and have found that although the server is still in Safe Mode something must have changed as I can now use ImageMagick again !

I want to do to things - on upload create a thumbnail image and a larger image that is watermarked.

I have looked out some of my old code and tried it along with some newer examples I have found here - posted below - and I have a demo page at http://www.rubble.info/TESTS/imagemagick/test.php

I find that I can create a thumbnail Ok but adding text to an image fails; I just get an image without the text. I have tried loads of different methods as sudgested here and on http://www.cit.gu.edu.au/~anthony/graphics/imagick6/ but can not get this to work.

If all else fails I will create a text "image" and use that instead but I would prefere to use the text method if possible.

Can somebody give me an idea where I am going wrong ?

Regards Anthony

Code: Select all

<h1>Add an image "Watermark"</h1>
<?php

exec("/usr/local/bin/composite -watermark 30% -gravity center piglet.gif earth.jpg  watermark_logo.jpg");

?>

<img src="watermark_logo.jpg">
<hr>
<h1>Create a thumbnail</h1>
<?php

exec("/usr/local/bin/convert -size 500x180  earth.jpg  -thumbnail 250x90 new.jpg");

?>

<img src="new.jpg">
<hr>

<h1>Add a "Text watermark" 1</h1>

<?php

exec("/usr/local/bin/convert -font arial -pointsize 10 -draw \" -gravity Center -fill black -text 'Copyright'\" earth.jpg wmark_text1.jpg");

?>

<img src="wmark_text1.jpg">
<hr>

<h1>Add a "Text watermark" 2</h1>

<?php

exec("/usr/local/bin/convert earth.jpg  -font arial -pointsize 20 -draw \"gravity south fill black  text 0,12 'Copyright' fill white  text 1,11 'Copyright' \"  wmark_text2.jpg");
?>

<img src="wmark_text2.jpg">

Posted: 2006-05-21T10:46:10-07:00
by Bonzo
After messing about with this all weekend I have decided my problem must be to do with the location of the font ?

I can resize images OK and I can add a watermark logo to the image OK but when ever I try anything to do with text it fails.
I have tried adding a text watermark, label and something else from the examples page and they all come back without any text.

I have called my font using arial, arial.ttf and the full path to the font ( it is in the same directory as the code ). I have moved it to the server root and it still will not work.

Anthony

Posted: 2006-05-23T10:52:57-07:00
by Bonzo
Oh well after about 20 hours at the weekend trying to get this to work I have decided to give up and go back to GD.

I have tried every example I can find and used everything I can think of to get the path to a font but everything fails.

The thing is thinking about this I had the same problem 3-4 years ago when I was trying this before and nothing has changed since then.
It seems as though I am not the only one as there are lots of posts about this on other forums and there have been 73 visits to this post over the 3 days its been on the forum.

My advice to others is ImageMagick is great unless you want to do anything that uses a font. If you want to use this to watermark an image either create the text to watermark in a gif or png on your PC or you could create something with GD and merge it into the image with ImageMagick.

Anyway here is a link http://www.rubblewebs.co.uk/imagemagick/ to some of the other items I have tried; if I can ever get a text watermarking method to work I will post the code there as well.
When I get some enthusiasm back regarding this I will add some more code/examples hopefully that will help others out.

Anthony

Posted: 2006-05-29T03:20:03-07:00
by Bonzo
Very much a bodge as far as I am concerned but I have had to resort to creating an image out of letters and then combining the two images to create a text watermark.

I need to create some decent gif letter files, and a method of picking the letter images depending on the string of text I want on the photo.

But I suppose it works.

Anthony

http://www.rubblewebs.co.uk/imagemagick ... k_text.php

Posted: 2006-06-11T02:43:21-07:00
by Bonzo
I finaly have this working although I need to sort ot some details and get the label and append working.

My host uploaded the latest version of the code and it still didn't work then they uploaded the "ghostscript " what ever that is and it worked.

Anthony

http://www.rubblewebs.co.uk/imagemagick ... k_text.php