Jump to content

Image generators


who_R_u
 Share

Recommended Posts

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...