在PHP中将十六进制背景颜色转换为GIF

时间:2011-09-19 19:25:24

标签: php image gd background-color

有没有办法使用PHP动态地将十六进制颜色(#fffff)转换为一个小的.GIF图像?

1 个答案:

答案 0 :(得分:6)

...

<?php
// create the image
$im = imagecreatetruecolor(100, 100);

// fill the image with the color you want
imagefilledrectangle($im, 0, 0, 99, 99, 0xFFFFFF);

// set the headers and output the image
header('Content-Type: image/gif');
imagegif($im);
imagedestroy($im);
?>

http://www.php.net/manual/en/function.imagegif.php