Advertisement
SergioRP

PHP drawBorder() function

Jul 21st, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. /* Thx to http://migre.me/9ZqmJ :) */
  2. function drawBorder(&$img, &$color, $thickness = 1)
  3. {
  4.     $x1 = 0;
  5.     $y1 = 0;
  6.     $x2 = imagesx($img) - 1;
  7.     $y2 = imagesy($img) - 1;
  8.    
  9.     for($i = 0; $i < $thickness; $i++)
  10.     {
  11.         imagerectangle($img, $x1++, $y1++, $x2--, $y2--, $color);
  12.     }
  13. }
  14. $verde = imagecolorallocate($img,0,255,0);
  15. drawBorder($img, $verde, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement