You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by ro...@apache.org on 2002/07/29 00:09:30 UTC
cvs commit: tcl-site/websh/examples image.html image.ws3 image_ws3.txt
ronnie 2002/07/28 15:09:30
Modified: websh/examples image.html image.ws3 image_ws3.txt
Log:
- fix url to image and setting of header
Revision Changes Path
1.3 +2 -4 tcl-site/websh/examples/image.html
Index: image.html
===================================================================
RCS file: /home/cvs/tcl-site/websh/examples/image.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- image.html 27 Jul 2002 16:41:26 -0000 1.2
+++ image.html 28 Jul 2002 22:09:30 -0000 1.3
@@ -19,15 +19,13 @@
<B><FONT COLOR="#A020F0">set</FONT></B> nr [<B><FONT COLOR="#A020F0">format</FONT></B> %2.2d [<B><FONT COLOR="#A020F0">expr</FONT></B> int(rand() * 13)]]
<I><FONT COLOR="#B22222"># open a file (JPEG is a binary format)
-</FONT></I> <B><FONT COLOR="#A020F0">set</FONT></B> fh [<B><FONT COLOR="#A020F0">open</FONT></B> [<B><FONT COLOR="#A020F0">file</FONT></B> <B><FONT COLOR="#A020F0">join</FONT></B> [web::config document_root] images memory $<FONT COLOR="#B8860B">nr</FONT>.jpg] r]
+</FONT></I> <B><FONT COLOR="#A020F0">set</FONT></B> fh [<B><FONT COLOR="#A020F0">open</FONT></B> [<B><FONT COLOR="#A020F0">file</FONT></B> <B><FONT COLOR="#A020F0">join</FONT></B> [web::config document_root] websh images memory $<FONT COLOR="#B8860B">nr</FONT>.jpg] r]
<B><FONT COLOR="#A020F0">fconfigure</FONT></B> $<FONT COLOR="#B8860B">fh</FONT> -translation binary
<B><FONT COLOR="#A020F0">set</FONT></B> img [<B><FONT COLOR="#A020F0">read</FONT></B> $<FONT COLOR="#B8860B">fh</FONT>]
close $<FONT COLOR="#B8860B">fh</FONT>
<I><FONT COLOR="#B22222"># set HTTP header to "image/jpeg" instead of "text/html"
-</FONT></I> <B><FONT COLOR="#A020F0">array</FONT></B> <B><FONT COLOR="#A020F0">set</FONT></B> headers [web::response -<B><FONT COLOR="#A020F0">set</FONT></B> header]
- <B><FONT COLOR="#A020F0">set</FONT></B> headers(Content-Type) <B><FONT COLOR="#A020F0">image</FONT></B>/jpeg
- web::response -<B><FONT COLOR="#A020F0">set</FONT></B> header [<B><FONT COLOR="#A020F0">array</FONT></B> get headers]
+</FONT></I> web::response -<B><FONT COLOR="#A020F0">set</FONT></B> Content-Type <B><FONT COLOR="#A020F0">image</FONT></B>/jpeg
<I><FONT COLOR="#B22222"># because we return a img, change to binary again
</FONT></I> <B><FONT COLOR="#A020F0">fconfigure</FONT></B> [web::response] -translation binary
1.4 +2 -4 tcl-site/websh/examples/image.ws3
Index: image.ws3
===================================================================
RCS file: /home/cvs/tcl-site/websh/examples/image.ws3,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- image.ws3 27 Jul 2002 16:41:26 -0000 1.3
+++ image.ws3 28 Jul 2002 22:09:30 -0000 1.4
@@ -8,15 +8,13 @@
set nr [format %2.2d [expr int(rand() * 13)]]
# open a file (JPEG is a binary format)
- set fh [open [file join [web::config document_root] images memory $nr.jpg] r]
+ set fh [open [file join [web::config document_root] websh images memory $nr.jpg] r]
fconfigure $fh -translation binary
set img [read $fh]
close $fh
# set HTTP header to "image/jpeg" instead of "text/html"
- array set headers [web::response -set header]
- set headers(Content-Type) image/jpeg
- web::response -set header [array get headers]
+ web::response -set Content-Type image/jpeg
# because we return a img, change to binary again
fconfigure [web::response] -translation binary
1.3 +2 -4 tcl-site/websh/examples/image_ws3.txt
Index: image_ws3.txt
===================================================================
RCS file: /home/cvs/tcl-site/websh/examples/image_ws3.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- image_ws3.txt 27 Jul 2002 16:41:26 -0000 1.2
+++ image_ws3.txt 28 Jul 2002 22:09:30 -0000 1.3
@@ -8,15 +8,13 @@
set nr [format %2.2d [expr int(rand() * 13)]]
# open a file (JPEG is a binary format)
- set fh [open [file join [web::config document_root] images memory $nr.jpg] r]
+ set fh [open [file join [web::config document_root] websh images memory $nr.jpg] r]
fconfigure $fh -translation binary
set img [read $fh]
close $fh
# set HTTP header to "image/jpeg" instead of "text/html"
- array set headers [web::response -set header]
- set headers(Content-Type) image/jpeg
- web::response -set header [array get headers]
+ web::response -set Content-Type image/jpeg
# because we return a img, change to binary again
fconfigure [web::response] -translation binary
---------------------------------------------------------------------
To unsubscribe, e-mail: tcl-site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: tcl-site-cvs-help@tcl.apache.org