For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > October 2006 > #39169 [Opn->Csd]: imagecolorallocate example uses incorrect snytax for imagecreat









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #39169 [Opn->Csd]: imagecolorallocate example uses incorrect snytax for imagecreat
colder@php.net

2006-10-16, 6:57 pm

ID: 39169
Updated by: colder@php.net
Reported By: neothermic at neothermic dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: N/A
PHP Version: Irrelevant
New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2006-10-16 19:13:53] neothermic at neothermic dot com

Description:
------------
In a related bug to #36447, imagecolorallocate has this example:

<?php

$im = imagecreate('example.jpg', 100, 100);

// sets background to red
$background = imagecolorallocate($im, 255, 0, 0);

// sets some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

// hexadecimal way
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);

?>

However, imagecreate has this syntax:
resource imagecreate ( int x_size, int y_size )

Ergo the first call in the example will issue an error.

Suggested fix is as simple as ever:

$im = imagecreate(100, 100);

NeoThermic



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=39169&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com