PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Doug Fairclough <kensey at clearstation dot com>
Subject: Re: GIF - straight to the browser
Date: Sep 10 1997 9:45PM

you can also do this :



 
 


where 'script' is the name of your graph spewing cgi and 
fee, fii, foo are parameters to that script that direct it on
what image to read in using GD and modify.

for example, doing this :

http://www.hotwired.com/cgi-bin/env/fdsa/fdsa

you get this in the environment :

SCRIPT_URL = /cgi-bin/env/fdsa/fdsa

so you can totally pass parameters in this way.  in this case, the name
of an image to modify in GD and 'print' out.

doug

On Wed, 10 Sep 1997, Ed Barlow wrote:

> Yes... you can have the browser read a single file.  That file can
> be of any mime type.  The only way to embed images (or whatever) into
> another document is to use the IMG tag in html which will cause another
> GET of whatever that file is.  So if you use GD and wish to put multiple
> thingies on a web page, you must write to files and then reference those
> files using the IMG tag.
> 
> This meshes with what i know
> Cheers
> Ed
> 
> Doug Fairclough wrote:
> > 
> > no, you cant do it from html, but you can write a script as floyd did
> > below and spit out any mime-type directly onto the wire.  web servers
> > handle all mime-types the same - spit out header information describing
> > the object to the browser, and the write out the object directly onto
> > the wire.
> > 
> > for example, if i telnet to port 80 of my web server and issue the
> > GET directly, this is what happends :
> > 
> > telnet 207.21.98.69 80
> > Trying 207.21.98.69...
> > Connected to 207.21.98.69.
> > Escape character is '^]'.
> > GET /gifs/spacer.gif HTTP/1.0
> > 
> > HTTP/1.1 200 OK
> > Date: Wed, 10 Sep 1997 17:56:20 GMT
> > Server: Apache/1.2.1
> > Last-Modified: Fri, 15 Aug 1997 21:40:15 GMT
> > ETag: "6b19a-2c-33f4ccbf"
> > Content-Length: 44
> > Accept-Ranges: bytes
> > Connection: close
> > Content-Type: image/gif
> > 
> > GIF89a
> > {unprintables, ie - the bytes of the gif, go here}
> > 
> > web servers simply look at the extension (ie - filetype, be it .gif, .jpg
> > or .html) and map it to the appropriate content-type, so that it knows
> > what Content-Type: to put in the header.  this is automatically done.
> > 
> > when a .cgi is run, there is
> > no way to know for the web server what the content type is, so the
> > webserver _does not_ split out the Content-Type header for you.  you
> > have to do it yourself.  and it can be any mime-type you want.  but
> > thats why so many people forget to put 'print Content-Type: .....'
> > in their script, as this is done by the web server in all cases
> > except when the CGI gateway interface is used ...
> > 
> > floyd just needs to monkey with his headers to get it right, and duplicate
> > _exactly_ what happened when i did 'GET /gifs/spacer.gif HTTP/1.0'
> > from port 80 of my box.  you dont need all those headers (the more you
> > specify, the better, especially 'Content-Length'.
> > 
> > doug
> > 
> > On Wed, 10 Sep 1997, Ed Barlow wrote:
> > 
> > > Are you are saying i can inline an image in the html directly...  No
> > > multiple hits to retrieve a page... something like
> > >
> > > Content-type: text/html
> > >
> > > Html Stuff
> > > Content-type: image/gif
> > >
> > > Gif Stuff
> > >
> > > More Html Stuff
> > >
> > >
> > > Provided i code it right.  I looked in depth at this a while ago and
> > > thought it impossible...
> > >
> > > Cheers
> > > Ed
> > >
> > > Doug Fairclough wrote:
> > > >
> > > > thats incorrect, i've done it before.  try taking a look at rfc2068.
> > > >
> > > > On Tue, 9 Sep 1997, Ed Barlow wrote:
> > > >
> > > > > You can NOT do it
> > > > >
> > > > > I think the next version of the html spec will support it.
> > > > >
> > > > > Cheers
> > > > > Ed
> > > > >
> > > > > floyd@interactive.net wrote:
> > > > > >
> > > > > > I'm generating GIFs using the GD perl module (its very nice).
> > > > > > I want to bring the GIFs directly back to the browser, instead
> > > > > > of using an IMG tag in an HTML page.
> > > > > >
> > > > > > Content-type: image/gif does not work for me.  If you load a GIF
> > > > > > into your browser (eg http://www.xxx.yyy/abcd.gif) and view source,
> > > > > > you will see GIF87a followed by what i believe to be the source
> > > > > > of the GIF file.
> > > > > >
> > > > > > As a test, i wrote a simple CGI perl script and browsed it:
> > > > > >
> > > > > > #!/usr/bin/perl
> > > > > > #print "Content-type: image/gif"
> > > > > > open(X," > > > > > while () { print; }
> > > > > > close(X);
> > > > > > exit;
> > > > > >
> > > > > > this did not work - server 500 Server Error - malformed headed.
> > > > > > this is the same error i get when i added:
> > > > > >         print "Content-type: image/gif\n\n";
> > > > > >
> > > > > > However, if i change that line to:
> > > > > >         print "Content-type: text/html";
> > > > > >
> > > > > > and browse the script, then view source, the source looks EXACTLY the
> > > > > > same as just browsing the image and viewing source.
> > > > > >
> > > > > > Any thoughts out there?
> > > > > >
> > > > > > Christian Floyd Bevacqua
> > > > >
> > >
>