Re: Confused about how exactly to output image using imagepng function
| From: | itoctopus | Date: | Fri, 18 May 2007 00:55:01 +0000 |
| Subject: | Re: Confused about how exactly to output image using imagepng function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255097@lists.php.net to get a copy of this message | ||
Why are you creating your own captcha?
I used the first one I found on google and it worked fine for me.
--
itoctopus - http://www.itoctopus.com
"Dave M G" <martin@autotelic.com> wrote in message
news:464C4C73.7060003@autotelic.com...
> PHP list,
>
> I've looked at the manual entries for imagepng() and
> imagecreatetruecolor() functions for helping me to create a temporary
> image for a CAPTCHA system.
>
> However, I'm clearly messing up, as what I'm outputting is a bunch of
> ASCII gibberish to the screen.
>
> What I think I need to do in principle is first create the image with
> imagecreatetruecolor(), then define it as a PNG (?), then display it.
>
> So I've got something like this:
>
> $image = ImageCreate($width, $height);
> ImageFill($image, 0, 0, $black);
> echo '<img " src="' . Imagepng($image) . '"
height="' . $height . '"
> width="' . $width .'" alt="captcha" />' . "\n";
> ImageDestroy($image);
>
> As mentioned, this isn't working, so there's a fundamental concept about
> how PHP creates and displays images that I'm not getting.
>
> I'm trying to output an image that, ideally, won't be stored as a file.
> Or, if it has to be a temporary file, to delete it immediately after
> displaying it.
>
> What part am I not understanding?
>
> Thank you for any advice or information.
>
> --
> Dave M G
> Ubuntu Feisty 7.04
> Kernel 2.6.20-15-386