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

Re: [MacPerl-WebCGI] Q2 What use is Mime image/gif?



At 3:51 PM 7/23/00, Bert Altenburg wrote:
>I know. That was not the point of my question. Somewhere in my CGI I have
>a line
>print "<IMG SRC=$myPict>". From my booklet on HTML, <IMG SRC="mymug.gif>
>seems to be completely legitimate.
>
>So, if this were a gif, should I have written:
>
>print "Content-type: text/html\n\n";
>print "<HTML> bla bla
>print "Content-type: image/gif\n\n";
>print "BASE HREF bla bla
>print "<IMG SRC=$myPict>"
>print "Content-type: text/html\n\n";   #to get out of 'gif-mode' again ?
>rest of text stuff
>
>?

No. The output of your CGI, no matter what, should only send one 
header. That header should reflect what's being returned to the user. 
So, if your CGI returns an HTML document, the header should include 
the line
    "Content-type: text/html\n\n".

Your browser will do the right thing when it interprets the HTML. If 
it encounters "<IMG SRC="..." >, the browser will send a follow-up 
request to the server to get the image.

If the _only_ thing returned by your CGI is an image, then use
    "Content-type: image/gif\n\n"
or whatever is correct for the type of image being returned.

HTH.

1;

-- 

- Bruce

__Bruce_Van_Allen___bva@cruzio.com__Santa_Cruz_CA__

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