How do I save web images to App Engine's blobstore?

You can achieve the same without using blobstore api. I think you have to just get the url and get the content using urlfetch(). Content method and store it as a blob property url = "imageurl" result = urlfetch.

Fetch(url) if result. Status_code == 200: prof. Avatar = db.

Blob(result. Content) For further reference in storing and serving images from datastore as blob You can see this post for more on store-images-in-datastore.

You can achieve the same without using blobstore api. I think you have to just get the url and get the content using urlfetch(). Content method and store it as a blob property.

Url = "imageurl" result = urlfetch. Fetch(url) if result. Status_code == 200: prof.

Avatar = db. Blob(result. Content) For further reference in storing and serving images from datastore as blob.

You can see this post for more on store-images-in-datastore.

Thanks - this is much simpler. I also found this a good resource for serving images: code.google. Com/appengine/articles/python/… – Wraith Mar 23 at 2:33.

You can't just include the image as the payload of the blobstore HTTP request and expect it to understand what to do with it. The blobstore expects an application/multipart-form-data type message, which is what the browser provides when you upload to the blobstore. There's a library that does this for you here.

A future release of the SDK will include the ability to programmatically store blobs in the blobstore, which avoids the need for this nasty hack. If your images are less than 1MB in size, though, a much simpler solution is to store the image directly in the datastore, as Abdul suggests in his answer.

Thanks, Nick. Is it possible to mix and match the Blobstore to serve the images once they're uploaded so you don't have to make custom handlers for each model? An example is here stackoverflow.Com/questions/4763715/…, but it didn't work for me.

After all, a BlobProperty does not have a key. Is there a function in the Blobstore that would bridge the gap? – Wraith Mar 23 at 2:32 1 @Wraith No, you can only use the blobstore to serve images that are stored in the blobstore.

You could create a single model just to store images, though, and use a ReferenceProperty to refer to images from other models. – Nick Johnson Mar 23 at 3:03 used the hack suggested. Its giving a error of this king............. the RequestTooLargeError: The request to API call file.Append() was too large.

Thanks for the post we hope the api access for the same would be available soon...... – sandeep koduri Aug 13 at 10:57 @sandeep You need to break the write up into multiple chunks - individual API calls can be no more than 1MB. – Nick Johnson Aug 14 at 6:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions