You are telling us that row = dbs.image(filename=name) takes 1200-400ms on your server. That is a lot.
You should: 1) try cache the requests row = dbs(dbs.image.filename=name).select(cache=(cache.ram,3600)).first() periodically you will need to clear cache to prevent leaks. 2) create an index for image.filename On Monday, 8 October 2012 05:10:13 UTC-5, Jim Gregory wrote: > > > To optimize SEO, I prefer to use descriptive, keyword-rich image filenames > instead of the auto-generated names used by web2py. > > Currently, I am using a custom download function that looks up the > auto-generated filename in a database using the original filename as a key, > then uses the standard download function to retrieve it. > > def images(): > name = request.args(0) > row = dbs.image(filename=name) > if not row[file]: > raise HTTP(404) > else: > request.args.append(row[file]) > return response.download(request,dbs) > > This will retrieve an image using <img > src="/images/descriptive-filename.jpg"> instead of <img > src="/download/tablename.fieldname.bf4662d6c87d9b7f.636f726e65722d627261636b6574732e6a7067.jpg> > > However, this takes 3 times longer on to retrieve an image on our server > (about 1200 ms vs 400 ms). > > Is there another way that is relatively simple that 1) is fast, 2) > wouldn't break the default admin, and 3) automatically delete old images > when an image is updated in the admin? --

