note 106050 added to function.imagick-annotateimage
| From: | martin at psinas dot com | Date: | Thu, 06 Oct 2011 01:26:44 +0000 |
| Subject: | note 106050 added to function.imagick-annotateimage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183653@lists.php.net to get a copy of this message | ||
An additional note to Alan's comment below. If you set the gravity to SOUTHEAST (or the bottom
right) then the X value will offset the text by padding the right-hand side, not the left as manual
describes above.
For example:
<?php
// Create objects
$image = new Imagick('myImage.png');
// Watermark text
$text = 'Copyright';
// Create a new drawing palette
$draw = new ImagickDraw();
// Set font properties
$draw->setFont('Bookman-Demi');
$draw->setFontSize(20);
$draw->setFillColor('black');
// Position text at the bottom-right of the image
$draw->setGravity(Imagick::GRAVITY_SOUTHEAST);
// Draw text on the image
$image->annotateImage($draw, 10, 12, 0, $text);
// Draw text again slightly offset with a different color
$draw->setFillColor('white');
$image->annotateImage($draw, 11, 11, 0, $text);
// Set output image format
$image->setImageFormat('png');
// Output the new image
header('Content-type: image/png');
echo $image;
?>
----
Server IP: 208.69.120.55
Probable Submitter: 98.253.80.56
----
Manual Page -- http://www.php.net/manual/en/function.imagick-annotateimage.php
Edit -- https://master.php.net/note/edit/106050
Del: integrated -- https://master.php.net/note/delete/106050/integrated
Del: useless -- https://master.php.net/note/delete/106050/useless
Del: bad code -- https://master.php.net/note/delete/106050/bad+code
Del: spam -- https://master.php.net/note/delete/106050/spam
Del: non-english -- https://master.php.net/note/delete/106050/non-english
Del: in docs -- https://master.php.net/note/delete/106050/in+docs
Del: other reasons-- https://master.php.net/note/delete/106050
Reject -- https://master.php.net/note/reject/106050
Search -- https://master.php.net/manage/user-notes.php