Adds borders to the image With PHP/GD

เริ่มโดย astkboy2008, 07 สิงหาคม 2010, 02:34:20

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

astkboy2008

Adds borders to the image. The borders array should have the indexes tl, tt, tr, rr, br, bb, bl, ll correspoding to that area's border. (see the example below for a better explanation)

Note: This function is fairly slow, so it would be best to apply it once, then save it for future showings.

Also, the wider the top(tt) and bottom(bb) and the longer the left(ll) and right(rr) borders are the faster the function will perform. They CAN be longer and wider than the actual image itself.

Example$img = imagecreatefromjpeg('baseimage.jpg');
// create the base image

$borders = array(    'tl'=>'topleft.jpg',
                    'tt'=>'top.jpg',
                    'tr'=>'topright.jpg',
                    'rr'=>'right.jpg',
                    'br'=>'bottomright.jpg',
                    'bb'=>'bottom.jpg',
                    'bl'=>'bottomleft.jpg',
                    'll'=>'left.jpg');
// create your array with borders
// Note, the array indexes must be the same as above

$dest = image_borders($img, $borders);
// actually make the image

header('Content-type: image/png');
// send a header

imagepng($dest);
// send it to the browser


the function here