Baz has asked for the wisdom of the Perl Monks concerning the following question:

Hi im using GD to print out a png image, my printing code looks something like this -
print header(-type=>'image/png'); binmode STDOUT; print $im->png;
This works fine. Now i want to print 2 png images and some text too. Ive had no success though. To print text I added the following two lines just after calling the 3 lines above - but nothing prints out.
print header; print "hello world";
What am I doing wrong?? Im thinking that perhaps all this needs to be embedded in html code - so that i can direct where on the screne various stuff should be displayed.... Thanks.

Replies are listed 'Best First'.
Re: Using GD.pm
by broquaint (Abbot) on May 05, 2002 at 17:06 UTC
    This is a limitation of HTTP and not GD. The reason is that you can only output one type of content[1] per request e.g either the content is an image or the content is text.

    An option here would be to have <img> tags whose src attribute points to a perl script that prints out the requested image. So your content-type will be text/html, while the images your perl script will output will be image/png.

    For more info on HTTP check out the rfc.
    HTH

    _________
    broquaint

    [1] you can have multiple types of content (see. here), but that won't do what you expect.