Re: How to create an image on the fly?
- From: Erwin Moller <since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx>
- Date: Tue, 30 Jan 2007 16:21:05 +0100
Gunnar G wrote:
Hi.
I've created an image with this code
Header("Content-Type: image/png");
$image = ImageCreate($W,$H);
$white = ImageColorAllocate($image,255,255,255);
$black = ImageColorAllocate($image,0,0,0);
ImageLine($image,0,0,$W,$H,$black);
ImagePng($image);
ImageDestroy($image);
but now I wish to add a line
echo "Hello";
before the image code, then I only get garbage, the header command is
probably invalid now. So how do I create the image without having to save
the image to a file?
Hi Gunnar,
Your code should return html OR an image.
It cannot return both because they have different mimetypes.
So you need a script that returns html OR an image, not both.
A trick to debug your imagecreationscript is changing you
Header("Content-Type: image/png");
to
Header("Content-Type: text/html");
so you can see errors in your PHP-code.
Of course you'll have to put it back to the original when you think the
imagecreationscript runs fine.
Regards,
Erwin Moller
.
- References:
- How to create an image on the fly?
- From: Gunnar G
- How to create an image on the fly?
- Prev by Date: Re: creating and presenting an image in php
- Next by Date: Re: PHP and upload
- Previous by thread: How to create an image on the fly?
- Next by thread: Re: How to create an image on the fly?
- Index(es):
Relevant Pages
|