Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Streaming an image to a client  RSS feed

 
Ryan Bailey
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having some trouble displaying an image that I have stored in a database to the user. I know the image is being properly stored and retrieved, but I'm unsure how to stream it to a client. Below is a sniplet of my code.

Do I need to specifiy a content type? Do I need to adjust the headers? If so what? When I run this code it is generating the file in a stream of numbers, which is expected. The problem is I'm not sure how to set the format for the client to accept this binary stream as a jpg picture.
Any help would be greatly appreciated.
Thank you,
Ryan



< edited by MC to turn tabs into spaces in the code block >
[ February 07, 2003: Message edited by: Mike Curwen ]
 
Ryan Bailey
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never @#$@# mind.
I guess I needed to call write INSTEAD of print.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will be considerably faster if you read and write bufferloads of some reasonable size.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!