who_R_u Posted May 4, 2006 Share Posted May 4, 2006 I want my site to have a image generator where I can type in what I want then click submit and it will it will bring me to another page with what I typed on the image. Can someone tell me how todo that? I have checked the website and cant find what I want. Link to comment Share on other sites More sharing options...
Nakor Posted May 4, 2006 Share Posted May 4, 2006 This all depends. What are you trying to do? Do you want it to simply put the text you typed over a certain background or are you thinking of something like Captcha? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 4, 2006 Share Posted May 4, 2006 You are going to want to use this as a reference:http://www.php.net/manual/en/ref.image.phpThe functions you are going to use will either be imagecreatetruecolor (if you are creating a new image) or imagecreatefromjpeg (or another one) if you want to start with an image, and put text over it. Then eventually you use imagestring to actually write the text. See the page on imagecreatetruecolor or imagestring for some examples and links to other functions. imagecreatetruecolor has this example: <?php$im = @imagecreatetruecolor(50, 100) or die("Cannot Initialize new GD image stream");$text_color = imagecolorallocate($im, 233, 14, 91);imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);header ("Content-type: image/png");imagepng($im);imagedestroy($im);?> Link to comment Share on other sites More sharing options...
who_R_u Posted May 5, 2006 Author Share Posted May 5, 2006 Thanks Link to comment Share on other sites More sharing options...
Little Goat Posted May 5, 2006 Share Posted May 5, 2006 hey justsomeguy, thanks for putting that script on here! I adapted it to make an image of the output of a counter script: <?php$text=include("hits.php");$im = @imagecreatetruecolor(10*strlen($text)+10,25); /*or die("Cannot Initialize new GD image stream");*/$text_color = imagecolorallocate($im, 233, 14, 91);imagestring($im, 5, 5, 5, $text, $text_color);header ("Content-type: image/png");imagepng($im);imagedestroy($im);?> Link to comment Share on other sites More sharing options...
justsomeguy Posted May 5, 2006 Share Posted May 5, 2006 Yeah, there you go. PHP.net has a lot of good stuff, browse around the function reference sometime. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now