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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.