island Posted November 12, 2007 Share Posted November 12, 2007 Hello, Is there any way to get text printed in image by imagestring ? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
centerwork Posted November 12, 2007 Share Posted November 12, 2007 Just fillin the variables specified here: http://us2.php.net/manual/en/function.imagestring.php Quote Link to comment Share on other sites More sharing options...
island Posted November 12, 2007 Author Share Posted November 12, 2007 thanks for replay. Yes, but me i need to find how to get the text on image after when it printed for example : $alphanum = "ABCDEFGHIJKLMNPQRSTUVWXYZ123456789"; $rand = substr(str_shuffle($alphanum), 0, 5); $_SESSION['image_random_value'] = md5($rand); $image = imagecreatefromjpeg("img/bg".rand(1,2).".jpg"); $bgColor = imagecolorallocate ($image, 255, 255, 255); $textColor = imagecolorallocate ($image, 0, 0, 0); imagestring ($image, 5, 5, 2, $rand, $textColor); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header('Content-type: image/jpeg'); imagejpeg($image); imagedestroy($image); This code print a random text in an image and send it to navagator, my question is how to get text printed in image ? Thanks in advance Quote Link to comment Share on other sites More sharing options...
gin Posted November 13, 2007 Share Posted November 13, 2007 you want to read the text drawn in an img file? I think you've ventured out of PHP and into OCR. Can't you transfer the text some other way? The filename at least, if for some reason plain old variable won't swing it. Quote Link to comment Share on other sites More sharing options...
island Posted November 13, 2007 Author Share Posted November 13, 2007 I will poste my question in other way : a website use this script for doing captcha in form : $_SESSION['image_random_value'] = md5($rand); $image = imagecreatefromjpeg("img/bg".rand(1,2).".jpg"); $bgColor = imagecolorallocate ($image, 255, 255, 255); $textColor = imagecolorallocate ($image, 0, 0, 0); imagestring ($image, 5, 5, 2, $rand, $textColor); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header('Content-type: image/jpeg'); imagejpeg($image); imagedestroy($image); Is there any way to pass (or break) this captcha ? Quote Link to comment Share on other sites More sharing options...
island Posted November 19, 2007 Author Share Posted November 19, 2007 there's no solution ? 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.