Created
December 19, 2012 21:26
-
-
Save irazasyed/4340671 to your computer and use it in GitHub Desktop.
PHP: Draw Border to any image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------------------------------+ | |
| 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