i try some time ago, caching download with this parameters and didn't work.
perhaps you have to take a look to this http://groups.google.com/group/web2py/browse_thread/thread/c10235cb16c476f/d72d988abe41a3c1?lnk=gst&q=cache+download#d72d988abe41a3c1 On Sep 30, 11:14 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > Mind that > > @cache(request.env.path_info+request.env.query_string, > time_expire=3600, cache_model=cache.ram) > > my end up caching a lot of stuff and cause out of memory problems. > > Is there a way on GAE to have a normal form that includes a file > upload for the blobstore? I mean a form that includes other fields > that go in db normally? > > Some people have reported problems when videos where stored in > blobstore. Do you have any experience with it? > > On Sep 15, 5:59 pm, howesc <how...@umich.edu> wrote: > > > > > I have just such a setup - i'd give you the URL to the site, but it's > > not public yet....remind me in a week or two. > > > The link Martin gives is the best bit of blobstore info that i have > > found for web2py yet. i (cfhowes) wrote the 2 comments, so please let > > me know if they don't work - i may have made fixes and not updated the > > post. > > > also, i created a method that does image resizing and caches the image > > in memory for the gallery page, so yes the first load of the page may > > be slow (this also depends on frequency of use of the app on GAE), but > > subsequent visits are pretty quick. > > > here's the caching image resizing download method: > > > @cache(request.env.path_info+request.env.query_string, > > time_expire=3600, cache_model=cache.ram) > > def download(): > > > #handle non-gae download > > if not request.env.web2py_runtime_gae or not request.args[0]: > > return response.download(request,db) > > > #handle gae download > > my_uploads=db(db.artwork.image==request.args[0]).select()[0] > > if not my_uploads.blob_key: > > return None > > blob_info = blobstore.get(my_uploads.blob_key) > > > response.headers['Content-Type'] = blob_info.content_type; > > response.headers['Content-Disposition'] = "attachment; filename= > > %s" % blob_info.filename > > #response.headers['Cache-Control'] = "max-age=3600, must- > > revalidate" > > > if (len(request.args) > 1 and request.args[1]) or > > request.vars.width: > > if (len(request.args) > 1 and request.args[1]): > > request.vars.width = request.args[1] > > from google.appengine.api import images > > img = images.Image(blob_key=my_uploads.blob_key) > > if not request.vars.height: > > img.resize(int(request.vars.width)) > > else: > > logging.info("resize width and height") > > img.resize(int(request.vars.width), > > int(request.vars.height)) > > return img.execute_transforms(images.JPEG) > > else: > > response.headers['X-AppEngine-BlobKey'] = my_uploads.blob_key; > > return response.body.getvalue() > > > enjoy! > > > On Sep 15, 3:23 am, "Martin.Mulone" <mulone.mar...@gmail.com> wrote: > > > > First to use blobstore you have to enabled billing. Yes for your > > > approach i think the best is to use blobstore in gae. > > > > Take a look to this:http://www.web2pyslices.com/main/slices/take_slice/63 > > > > And to display images use the new introduce function get_serving_url > > > is really fast and doesnt consume much resources > > > you have to store blob_key) > > > > def _response_image(table_name='images',image_size=64): > > > if request.env.web2py_runtime_gae: > > > from google.appengine.ext import blobstore > > > from google.appengine.api import images > > > > if not request.args: > > > raise HTTP(404) > > > myimages=db(db[table_name].image==request.args[0]).select() > > > if myimages: > > > myimage = myimages[0] > > > if myimage.blob_key: > > > if GAE_SERVING_IMAGE: > > > image_serving = > > > images.get_serving_url(myimage.blob_key,image_size) > > > return image_serving > > > > On 15 sep, 07:08, István Gazsi <theag...@gmail.com> wrote: > > > > > Hi everybody! > > > > > As part of a website I try to make an image gallery in web2py. The > > > > database model is simple: there is a 100x100 thumbnail, the whole > > > > picture, and (optionally) the image's title. > > > > > The website runs on Google App Engine and web2py v1.83.2 for now. > > > > There are multiple problems with it. First, I can only upload images > > > > under 1MB. Second, the gallery page loads very slowly (I make a select > > > > for only 25 records in web2py), and in the GAE logs there is always > > > > warnings about memory usage. > > > > > For the first problem the solution would be using the GAE blobstore, > > > > but I don't really know how to do that. Is it implemented in web2py? > > > > For the second problem I don't know the solution. > > > > > If you would do an image gallery like mine from the ground up, how > > > > would you do that? And do you have any advices about my problems? > > > > > Thanks in advance!