53329 Posted February 18, 2008 Share Posted February 18, 2008 Title says it all but here is the code I have for reference anyway. Is there a way to add a border around the edge of this image without copying it? Keep in mind that the image has transparency. <?php $im = imagecreatefromgif("test.gif"); header("Content-type: image/gif"); imagegif($im); imagedestroy($im); ?> Thanks in advance for any help. Link to comment https://forums.phpfreaks.com/topic/91633-add-border-to-image-with-transparency/ Share on other sites More sharing options...
mem0ri Posted February 18, 2008 Share Posted February 18, 2008 You'll just want to add some CSS code when you display the image...somethin' like IMG { border:1px solid #000000; } Link to comment https://forums.phpfreaks.com/topic/91633-add-border-to-image-with-transparency/#findComment-469303 Share on other sites More sharing options...
53329 Posted February 18, 2008 Author Share Posted February 18, 2008 I actually can't because the images are on one host and they are being displayed elsewhere. Basically anything outside of the image itself is out of my control. Link to comment https://forums.phpfreaks.com/topic/91633-add-border-to-image-with-transparency/#findComment-469304 Share on other sites More sharing options...
53329 Posted February 18, 2008 Author Share Posted February 18, 2008 Fixed it. Here is for anyone else as I couldn't find this online. <?php $im = imagecreatefromgif("test.gif"); $width=imagesx($im); $height=imagesx($im); $border_color = imagecolorallocatealpha($im, 0, 0, 0, 0); imageline($im, 0, 0, ($width-1), 0, $border_color); imageline($im, 0, ($height-1), ($width-1), ($height-1), $border_color); imageline($im, 0, 0, 0, ($height-1), $border_color); imageline($im, ($width-1), 0, ($width-1), ($height-1), $border_color); header("Content-type: image/gif"); imagegif($im); imagedestroy($im); ?> Link to comment https://forums.phpfreaks.com/topic/91633-add-border-to-image-with-transparency/#findComment-469357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.