Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Created December 19, 2012 21:26
Show Gist options
  • Save irazasyed/4340671 to your computer and use it in GitHub Desktop.
Save irazasyed/4340671 to your computer and use it in GitHub Desktop.
PHP: Draw Border to any image.
/*------------------------------------------------------+
| Provide image resource, border color and thickness to
| add border to the resource.
+------------------------------------------------------*/
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment