Kevin
Kevin

Reputation: 1725

Trying to add border to image using imagecreate

I'm new to the imagecreate(), imagefilledrectangle, etc...trying to create an image with a border around it and I can't seem to figure out what i'm missing.

Here's my code:

$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);

New let's say I want to put a 1 px blue border around it, as defined by $blue above.

What do I need to add here to put this border on?

Thanks in advance as always.

Upvotes: 0

Views: 1896

Answers (1)

clover
clover

Reputation: 5170

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

Upvotes: 3

Related Questions