jaikob Posted January 7, 2008 Share Posted January 7, 2008 I have this code: <img src="<?php $captcha = imagecreatefrompng("captcha.png"); $black = imagecolorallocate($captcha, 0, 0, 0); $line = imagecolorallocate($captcha,233,239,239); imageline($captcha,0,0,39,29,$line); imageline($captcha,40,0,64,29,$line); imagestring($captcha, 5, 20, 10, $string, $black); header("Content-type: image/png"); imagepng($captcha); ?>" /> but all i get is a bunch of giberish like this: �8�OLW�C�A���C� �x���&���&fs6U��%R�I� V�P0Q�Y��i�t�S#��a�n%�&x�(���kv���ۘ� 7 how do i fix this. ps, I cannot include this on an include or seperate php file, it has to be in the same file, so i can work with vars set in a previous code on the page. Quote Link to comment https://forums.phpfreaks.com/topic/84938-solved-captcha-help/ Share on other sites More sharing options...
GingerRobot Posted January 7, 2008 Share Posted January 7, 2008 You have to link to it. Thats the way it works. If you need to use other variables, either pass them in the URL, or set a session. You should have one php file, lets say captcha.php with your image generation code, and then you should use: <img src="captcha.php?foo=bar" /> Quote Link to comment https://forums.phpfreaks.com/topic/84938-solved-captcha-help/#findComment-433084 Share on other sites More sharing options...
jaikob Posted January 7, 2008 Author Share Posted January 7, 2008 alright thank you. Quote Link to comment https://forums.phpfreaks.com/topic/84938-solved-captcha-help/#findComment-433087 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.