note 50981 modified in function.imagecolorallocate by danbrown

From: Date: Fri, 24 Apr 2009 12:50:49 +0000
Subject: note 50981 modified in function.imagecolorallocate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153668@lists.php.net to get a copy of this message
<?php /** * Create a image bar using lib GD * Ege. <img src="color_sample.php?color=FF0000" width="10 height="30"> */ // Split the HTML color representation $hexcolor = str_split($_GET["color"], 2); // Convert HEX values to DECIMAL $bincolor[0] = hexdec("0x{$hexcolor[0]}"); $bincolor[1] = hexdec("0x{$hexcolor[1]}"); $bincolor[2] = hexdec("0x{$hexcolor[2]}"); $im = ImageCreate(100, 100); $colorallocate = ImageColorAllocate($im, $bincolor[0], $bincolor[1], $bincolor[2]); ImageFilledRectangle($im, 0, 0, 100, 100, $colorallocate); header('Content-Type: image/png'); ImagePNG($im); ?> --was-- <? /** * Create a image bar using lib GD * Ege. <img src="color_sample.php?color=FF0000" width="10 height="30"> */ // Split the HTML color representation $hexcolor = str_split($_GET["color"], 2); // Convert HEX values to DECIMAL $bincolor[0] = hexdec("0x{$hexcolor[0]}"); $bincolor[1] = hexdec("0x{$hexcolor[1]}"); $bincolor[2] = hexdec("0x{$hexcolor[2]}"); $im = ImageCreate(100, 100); $colorallocate = ImageColorAllocate($im, $bincolor[0], $bincolor[1], $bincolor[2]); ImageFilledRectangle($im, 0, 0, 100, 100, $colorallocate); header('Content-Type: image/png'); ImagePNG($im); ?> http://php.net/manual/en/function.imagecolorallocate.php

« previous php.notes (#153668) next »