How do you return the blob key from a blob store? and subsequently return the image URL?
Example code:
class Next(webapp.RequestHandler):
def get(self):
userTable_name=self.request.get('userTable_name')
data = db.GqlQuery("SELECT * "
"FROM userTable "
"WHERE ANCESTOR IS :1 "
"ORDER BY date DESC LIMIT 10",
userTable_key(userTable_name))
self.response.headers['Content-Type'] = 'text/plain'
for user in data:
blobURL = get_serving_url(user.imageblob.key(), size=None, crop=False)
self.response.out.write(blobURL)
I’m using a GqlQuery to return a set of Blobs (i.e. user.imageblob) and for each blob i need to determine the BlobKey. From what I can tell, “user.imageblob.key()” does not return the blobkey…?
Worked it out! As it turns out, I was confusing “adding an image to the datastore as a blob” vs vs adding an image to the blobstore.
Hence,
get_serving_url()anduser.imageblob.key()were incorrectly pointing to the datastore as opposed to the blobstore.For examples of adding images to the blobstore see: http://code.google.com/appengine/docs/python/blobstore/overview.html