Another text watermark question
Posted: 2006-05-20T08:18:52-07:00
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
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">