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_url
 
which 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
>
>

Reply via email to