Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: CGI returning binary data

From: gscottjones:mchsi at: 14-Sep-2002 7:08

From: "Anton"
> I am looking for an example cgi > to return image data, eg. a gif image, > so it can be used like this: > > <img src="generate-img.cgi">
Hi, Anton, Borrowing from a thread a couple of weeks ago: ;;;;;jpeg.cgi in cgi-bin (or equivalent directory) #!/path/to/rebol -cs REBOL [] print "Content-type: image/jpeg^/" set-modes system/ports/output [binary: true] insert system/ports/output read/binary %//rebol/view/nyc.jpg ;;;;;;image.html file <html> <body> <h1>image/jpeg</h1> <center> <img border="1" src="http://localhost/cgi-bin/jpeg.cgi" alt="Streamed Image"> </center> </body> </html> I know it is not gif, but same principle. Hope this helps. --Scott Jones