尝试使用imagecreate为图像添加边框

时间:2013-01-24 23:03:25

标签: php html image

我是imagecreate(),imagefilledrectangle等的新手...试图创建一个带有边框的图像,我似乎无法弄清楚我错过了什么。

这是我的代码:

$im =  imagecreate (200,150);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
$blue = imagecolorallocate($im, 0, 105, 179);
$background = imagecolorallocate($im, 255, 255, 255);


imagefilledrectangle($im, 0, 0, 200, 150, $background);

新的假设我想在它周围放一个1像素的蓝色边框,如上面的$ blue定义。

我需要在这里添加什么来放置这个边框?

一如既往地感谢您。

1 个答案:

答案 0 :(得分:3)

imagerectangle($im, 0, 0, 199, 149, $blue);