Re: How to create an image on the fly?



Gunnar G <debian@xxxxxxxxx> 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?

Euhm, adding "hello" to the source of an image isn't really valid no :-)..

-----hello.html----
hello
<img src="imagecreator.php">
--------------------
---imagecreator.php-
//your php code
--------------------

--
Rik Wasmus
.



Relevant Pages

  • Re: PHP Blank Page.
    ... echo mysql_error, ... Rik Wasmus ... ID intunsigned zerofill NOT NULL auto_increment, ... PRIMARY KEY ...
    (comp.lang.php)
  • Re: PHP Blank Page.
    ... echo mysql_error, ... Rik Wasmus ... I can clearly see that's not the query you are performing. ... mysql> select * from questions; ...
    (comp.lang.php)
  • Re: [PHP] Re: Returning response includes HTML form data
    ... When I run it from a Windows client program, the response I am seeing is not only the "someresponse" above but also has the entire HTML form in the PHP file appended to it. ... echo "SomePHPFunction called for $param1 OK.\n"; ... Am I not 'responding' to the form in my PHP code based on the input parameters to the form in my PHP code? ...
    (php.general)
  • Re: PHP Blank Page.
    ... > Wether there's a parse error in your other includes I couldn't say. ... > echo it to check wether the result has data or is empty, ... > Rik Wasmus ... I removed the header file and now it doesn't report anything. ...
    (comp.lang.php)
  • Re: [PHP] POST + QUERY
    ... Dan Shirah wrote: ... However I have verified the correct spelling both in the database and in the ... PHP code and they are identical and when I print_r it shows that there is a ... >> the above echo still returns nothing. ...
    (php.general)