carlbulman Posted September 6, 2010 Share Posted September 6, 2010 The following code is what I am trying to use for doing a form captcha style verification and all it is throwing back when I load the page is an image of the website address. Does anyone here know where I am going wrong? I have been at this all day and gotten nowhere. Thanks in advance <?php session_start(); $rndval = rand(1000, 9999); $_SESSION['rndnum'] = md5($rndval); $img = imagecreate(60, 30); $bgc = imagecolorallocate ($img, 255, 251, 205); $fontcolor = imagecolorallocate ($img, 0, 0, 0); imagestring ($img, 5, 5, 8, $rndval, $fontcolor); header('Content-type: image/jpeg'); imagejpeg($img); imagedestroy($img); ?> Link to comment https://forums.phpfreaks.com/topic/212627-php-and-gd-captcha/ Share on other sites More sharing options...
carlbulman Posted September 6, 2010 Author Share Posted September 6, 2010 Solved my own problem by helping another guy on here. To much coffee Was a simple error solved by changing ' for a " in the header: header('Content-type: image/jpeg'); it now reads: header("Content-type: image/jpeg"); Link to comment https://forums.phpfreaks.com/topic/212627-php-and-gd-captcha/#findComment-1107689 Share on other sites More sharing options...
objnoob Posted September 6, 2010 Share Posted September 6, 2010 It should have worked using single quotes as well?! Link to comment https://forums.phpfreaks.com/topic/212627-php-and-gd-captcha/#findComment-1107698 Share on other sites More sharing options...
coupe-r Posted September 6, 2010 Share Posted September 6, 2010 it does Link to comment https://forums.phpfreaks.com/topic/212627-php-and-gd-captcha/#findComment-1107700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.