asmith Posted May 30, 2008 Share Posted May 30, 2008 He guys with a simple code i'm creating some captcha : header("Content-Type: image/png"); // or image/jpg // create the image resource $image = ImageCreatefromgif("background.gif"); then at last puting characters in the image : imagettftext($image, 30, angle, width, height, color, font, character); i've tried using a transparent gif image for that , but the output background was black. is there any way i could make a trasparent background for it? Link to comment https://forums.phpfreaks.com/topic/108009-trasparent-background-for-captcha/ Share on other sites More sharing options...
BlueSkyIS Posted May 30, 2008 Share Posted May 30, 2008 you might want to use imagecreatetruecolor() followed by imagecolortransparent, instead of creating the image from an existing gif. Link to comment https://forums.phpfreaks.com/topic/108009-trasparent-background-for-captcha/#findComment-553593 Share on other sites More sharing options...
Millar Posted May 30, 2008 Share Posted May 30, 2008 <?php $png = imagecreatetruecolor(800, 600); imagesavealpha($png, true); $trans_colour = imagecolorallocatealpha($png, 0, 0, 0, 127); imagefill($png, 0, 0, $trans_colour); $red = imagecolorallocate($png, 255, 0, 0); imagettftext($png, 30, angle, width, height, $red, font, character); header("Content-type: image/png"); imagepng($png); ?> That *should* work. :S Link to comment https://forums.phpfreaks.com/topic/108009-trasparent-background-for-captcha/#findComment-553603 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.