如何为使用
PHP创建的图像赋予边框?
- function drawBorder(&$img,&$color,$thickness = 1)
- {
- $x1 = 0;
- $y1 = 0;
- $x2 = ImageSX($img) - 1;
- $y2 = ImageSY($img) - 1;
- for($i = 0; $i < $thickness; $i++)
- {
- ImageRectangle($img,$x1++,$y1++,$x2--,$y2--,$color);
- }
- }
然后用法只是做.
- $color = imagecolorallocate($img,255,0);
- drawBorder($img,$color,255);