Peter, I was trying to get this to work last week and this is what finally worked for me. Here's a link to my earlier thread on the same topic. https://groups.google.com/forum/?fromgroups#!topic/web2py/1h3Nd3_T9Js
In my case I'm storing small blobs in the table/model - although that's not the best approach. However I was surprised that I has to make an explicit reference to the blob field, as I expected that to be handled implicitly. If there's a better way here, plaese let me know. The following should work for you: def show_image(): """ return image - this method is referenced from the view - see below """ if not request.args[0]: return None id = request.args[0] image=db(db.imgtbl.id==id).select() return image[0].image_blob my view code {{extend 'layout.html'}} <h3>Display Jpeg Images</h3> <table border="1"> <tr> <th>Image Title</th> <th>Image</th> </tr> {{for img in images:}} <tr> {{= TD(img.title)}} {{= TD(IMG(_src=URL("show_image", args=img.id), _alt=img.title)) }} </tr> {{pass}} </table> On Monday, February 27, 2012 12:01:55 PM UTC-8, howesc wrote: > > i'm using the blobstore so i can upload images larger than 1mb. because > of that i have access to > http://code.google.com/appengine/docs/python/images/functions.html#Image_get_serving_urlwhich > gives a URL that google serves up the image (and does not count > against CPU for your app engine app). > > my image upload is a variant of > http://www.web2pyslices.com/slices/take_slice/63 > > cfh. > > On Sunday, February 26, 2012 6:13:14 AM UTC-8, Anthony wrote: >> >> On Sunday, February 26, 2012 12:19:17 AM UTC-5, Peter G. wrote: >>> >>> How would one obtain the URL to a image blob stored on GAE's >>> datastore? A lot of the threads I've looked at were all for generating >>> an download output for views, but I need this for the Controller since >>> I'm returning this as a JSON element. >>> >>> For example, the auth_user table has a field 'avatar' and another blob >>> field 'avatar_blob'. Ideally I can simply return a JSON like: >>> { "avatar": "http://<domain>/<app>/avatars/username_avatar.gif" } >>> >>> Where username_avatar.gif would map to the stored blob image for that >>> user's avatar. >> >> >> Assuming you use web2py's standard "upload" field type to upload the >> images, then you would still use the standard download process as well. See >> the "Uploading files in database" section in >> http://web2py.com/books/default/chapter/29/13 for details on setting up >> database storage of uploads. And for downloading, see the >> response.download description here: >> http://web2py.com/books/default/chapter/29/4#response. In your case, it >> would be something like: >> >> db.define_table('auth_user', >> ..., >> Field('avatar', 'upload', uploadfield='avatar_blob'), >> Field('avatar_blob', 'blob'), ...) >> >> def download(): >> return response.download(request, db) >> >> URL for a particular user's avatar: >> >> URL('default', 'download', args=auth.user.avatar) >> >> Anthony >> >> > On Sunday, February 26, 2012 6:13:14 AM UTC-8, Anthony wrote: >> >> On Sunday, February 26, 2012 12:19:17 AM UTC-5, Peter G. wrote: >>> >>> How would one obtain the URL to a image blob stored on GAE's >>> datastore? A lot of the threads I've looked at were all for generating >>> an download output for views, but I need this for the Controller since >>> I'm returning this as a JSON element. >>> >>> For example, the auth_user table has a field 'avatar' and another blob >>> field 'avatar_blob'. Ideally I can simply return a JSON like: >>> { "avatar": "http://<domain>/<app>/avatars/username_avatar.gif" } >>> >>> Where username_avatar.gif would map to the stored blob image for that >>> user's avatar. >> >> >> Assuming you use web2py's standard "upload" field type to upload the >> images, then you would still use the standard download process as well. See >> the "Uploading files in database" section in >> http://web2py.com/books/default/chapter/29/13 for details on setting up >> database storage of uploads. And for downloading, see the >> response.download description here: >> http://web2py.com/books/default/chapter/29/4#response. In your case, it >> would be something like: >> >> db.define_table('auth_user', >> ..., >> Field('avatar', 'upload', uploadfield='avatar_blob'), >> Field('avatar_blob', 'blob'), ...) >> >> def download(): >> return response.download(request, db) >> >> URL for a particular user's avatar: >> >> URL('default', 'download', args=auth.user.avatar) >> >> Anthony >> >> > On Sunday, February 26, 2012 6:13:14 AM UTC-8, Anthony wrote: >> >> On Sunday, February 26, 2012 12:19:17 AM UTC-5, Peter G. wrote: >>> >>> How would one obtain the URL to a image blob stored on GAE's >>> datastore? A lot of the threads I've looked at were all for generating >>> an download output for views, but I need this for the Controller since >>> I'm returning this as a JSON element. >>> >>> For example, the auth_user table has a field 'avatar' and another blob >>> field 'avatar_blob'. Ideally I can simply return a JSON like: >>> { "avatar": "http://<domain>/<app>/avatars/username_avatar.gif" } >>> >>> Where username_avatar.gif would map to the stored blob image for that >>> user's avatar. >> >> >> Assuming you use web2py's standard "upload" field type to upload the >> images, then you would still use the standard download process as well. See >> the "Uploading files in database" section in >> http://web2py.com/books/default/chapter/29/13 for details on setting up >> database storage of uploads. And for downloading, see the >> response.download description here: >> http://web2py.com/books/default/chapter/29/4#response. In your case, it >> would be something like: >> >> db.define_table('auth_user', >> ..., >> Field('avatar', 'upload', uploadfield='avatar_blob'), >> Field('avatar_blob', 'blob'), ...) >> >> def download(): >> return response.download(request, db) >> >> URL for a particular user's avatar: >> >> URL('default', 'download', args=auth.user.avatar) >> >> Anthony >> >>