How should be the proper way to stream an image file with webpy?
For example, I generate thumbnails on the fly using "something" like
this:
import Image
import cStringIO
urls = (
...
'/thumb/(.+\.jpg)/(\d+)x(\d+)', 'Thumb'
)
class Thumb:
def GET(self, file_path, width, height):
im = Image.open(file_path)
thumb = cStringIO.StringIO()
im.thumbnail((int(width), int(height)), Image.ANTIALIAS)
im.save(thumb, "JPEG")
web.header('Content-type', 'image/jpeg')
return thumb.getvalue()
my main question is about streaming the file, not in generating the
thumbnails.
Any suggestions are welcome.
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.