[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] Sending images from a cgi



Adam,

I don't know why your approach isn't working but here are a couple of
possible work arounds.

1) Can the whole web page be generated by Perl? If so you could...

<HTML><HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=make_map.cgi/path/whatever.htm">
<TITLE>Same title as used by whatever.htm (or not)</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

The "make_map.cgi" program could create the map file and then read and
output "whatever.htm". I use this approach with template html files so I
can substitute tables of data, etc., in the place of default text.


2) If you have SSI you could try using "#exec cgi" to run a Perl program to
create the map and save a file that can be used in your IMG tag. I quess
this would only work if browsers wait for the cgi to be completed before
they resume displaying the page, or if the page took long enough to load
other stuff before.


David Seay
http://www.mastercall.com/g-s/


>Hi,
>
>I have encountered a bit of a problem. I'm trying to write a map
>generator. It is simple enough - the user specifies a location, the
>cgi opens a data file to find the map co-ordinates, and then opens
>the map and drops a pointer (like a big red x) onto those
>co-ordinates. It then crops the image, so we get a 200x200 (or some
>other figure) gif, with the pointer right in the middle. Simple
>enough?
>
>Well, I thought so. Everything was working fine - it works perfectly,
>and can save the image to disk. What it can't do is send the image to
>the web page when you call it with <IMG SRC="cgi-bin/map.cgi"> and I
>have no idea why. I am using GD, and the output code is:
>
>sub display_image
>   {
>   # Convert the image to GIF and send it out
>
>   print "Content-type: image/gif\n\n";
>   print $map->gif;
>   }
>
>What really annoys me is that occasionally it even seems to work.
>Maybe, but I'm not sure of this yet, it is working the first time the
>cgi is fired up, but then doesn't work until it closes and has to be
>restarted. Is this possible? Does anyone have any ideas, as I thought
>I was making great progress until this happened.
>
>
>Regards,
>
>Adam.
>--
>--------------------------------------------------------------------
>Web Author			phone: (08) 8201-3139 (after 1:30pm)
>Flinders University		email: adam.jenkins@flinders.edu.au
>http://www.flinders.edu.au/ 	Room 21J, Physical Sciences Building



==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org