php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51077 Example is wrong
Submitted: 2010-02-18 01:05 UTC Modified: 2010-02-18 09:58 UTC
From: awysocki at absoftware dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.2.12 OS: CentOS 5.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: awysocki at absoftware dot com
New email:
PHP Version: OS:

 

 [2010-02-18 01:05 UTC] awysocki at absoftware dot com
Description:
------------
Example of Imagick::annotateImage is incorrect

Instead of 

/* Black text */
$pixel->setColor('black');

It should be

/* Bluse text */  
$draw->setFillColor('blue');


The function selects BLACK as the default and the setColor is working on the image not the text

Reproduce code:
---------------
---
From manual page: http://www.php.net/function.imagick-annotateimage#See Also
---
<?php
/* Create some objects */
$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel( 'gray' );

/* New image */
$image->newImage(800, 75, $pixel);


/* Font properties */
$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize( 30 );
$draw->setFillColor('black' );

/* Create text */
$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');

/* Give image a format */
$image->setImageFormat('png');

/* Output the image with headers */
header('Content-type: image/png');
echo $image;

?>


Expected result:
----------------
See Above

Actual result:
--------------
See Above

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-18 09:57 UTC] svn@php.net
Automatic comment from SVN on behalf of degeberg
Revision: http://svn.php.net/viewvc/?view=revision&revision=295231
Log: Corrected example on Imagick::annotateImage() (fixes bug #51077)
 [2010-02-18 09:58 UTC] degeberg@php.net
-Status: Open
+Status: Closed

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 22:00:01 2026 UTC