In the app that I've developed with tg2.0 I fetch images from a db. This is my
controller:
@expose(content_type="image/jpeg")
def picture(self, id):
return search_picture(id)
This works pretty well but the stored images are a bit heavy (around ~200kb)
and takes to the browser valuable seconds to load. I'm in the same situation
as in my previous post:
I'd like that the pictures were loaded only once and then cached by the browser.
Any ideas?
I've thought about inserting the http headers from my controller (calling to
pylons.request.headers & .response), but I'd have to implement the mechanism
and I don't want to reinvent the weel.
Cheers,
Happy new year =) !
--
Mauro Ciancio <maurociancio at gmail dot com>
On Wed, Dec 30, 2009 at 7:33 PM, Jose Galvez <jj.g...@gmail.com> wrote:
> reading over your link it looks like you have a partial solution, at
> least as indicated by Diez, could you provide a link to that as well so
> that we don't have to go looking for it?
Sure, here is the tw's thread:
http://groups.google.com/group/toscawidgets-discuss/browse_thread/thread/28d10531a3e00869
In that thread I was looking for a solution to serve statically
tw's css & js files. The solution provided by Diez is great, but
that doesn't applies to this problem because the images are fetched
from a db (and not from the filesystem).
Any ideas?
Thanks again.
You need to render, compare and react an ETag field, and use that to
either deliver the image, or return a response with status code 304.
Diez
On Thu, Dec 31, 2009 at 3:14 PM, Diez B. Roggisch <de...@web.de> wrote:
> You need to render, compare and react an ETag field, and use that to
> either deliver the image, or return a response with status code 304.
Ok, that was I thought.
Thanks again Diez.
Cheers!
http://turbogears.org/2.1/docs/main/Caching.html
Thanks to all.
Cheers.