1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| // create a 200*60 image
$im = imagecreate(200, 60);
// white background and blue text
$bg = imagecolorallocate($im, 222, 222, 222);
$textcolor = imagecolorallocate($im, 0, 0, 255);
// write the string
imagestring($im, 5, 30, 20, "SmileyLover.Com", $textcolor);
//border
$bordercolors = imagecolorallocate($im, 255, 255, 20); //Define border color Yellow
$x = 0;
$y = 0;
$w = imagesx($im) - 1; //get width image and decrease 1px or points ?
$h = imagesy($im) - 1; //get height image and decrease 1px or points ?
imageline($im, $x,$y,$x,$y+$h,$bordercolors); //left
imageline($im, $x,$y,$x+$w,$y,$bordercolors); //top
imageline($im, $x+$w,$y,$x+$w,$y+$h,$bordercolors); //right
imageline($im, $x,$y+$h,$x+$w,$y+$h,$bordercolors); //bottom
//end border
// output the image
header("Content-type: image/png");
imagepng($im); |
Partager