[REBOL] Re: Output Image from Web Server to Web Browser
From: compkarori::gmail at: 12-Oct-2008 8:52
Von
This is what I do in Cheyenne - code taken from my web to hylafax portal
recvqdir: %/var/spool/hylafax/recvq/
file: dehex request/content/filename
switch suffix? file [
%.tif [ response/set-header 'Content-type "image/tiff" ]
%.pdf [ response/set-header 'Content-type "application/pdf" ]
]
response/set-header 'Content-disposition join "attachment; filename=" file
response/buffer: read/binary join recvqdir file file
On Sun, Oct 12, 2008 at 6:12 PM, Von <vonja-sbcglobal.net> wrote:
> Hello Rebol Group:
>
> I'm attempting to output a binary image
>
> from a server (i.e., Linux) cgi script
>
> to a web browser using the below codes
>
> but I've been unsuccessful. I've scoured
>
> Rebol sources on and offline to no avail.
>
> Thanks in advance for your help. --Von
>
> For example:
>
> Rebol []
> data: read/binary %/some/image.jpg
> print "Content-Type: image/jpg^/"
> ;; or "Content-Type: image/jpeg^/^/"
> ;; or "Content-Type: image/jpeg"
> write-io system/ports/output data length? Data
> ;; or print data
> ;; or print join "Location: " data
> ;; with or w/o print join "Expires: 0" newline
>
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
Graham Chiu
http://www.synapsedirect.com
Synapse - the use from anywhere EMR.