【php开源代码栏目提醒】:以下是网学会员为您推荐的php开源代码-9.14.php,希望本篇文章对您学习有所帮助。
<?php
header("Content-type: image/png");
$im = imagecreate(200, 200);
$red = imagecolorallocate($im, 255, 0, 0);
// create a shade of blue
$offblue = imagecolorallocate($im, 90, 90, 200);
imagefill($im, 0, 0, $red);
imagefilledrectangle($im, 10, 10, 40, 40, $offblue);
// get closest color to actual blue from image
$newblue = imagecolorclosest($im, 0, 0, 255);
imagefilledrectangle($im, 100, 100, 140, 140, $newblue);
imagepng($im);
imagedestroy($im);
?>