Question

I have an appengine connected android project. It's using endpoints. Anyway, I have some images in the blobstore. The android app has the url to each image. Normally, android needs a full image. But for my GridView I want to display a number of thumbnails. I know how to fetch images from a server (here the blobstore). My question is, is there a way to ask the blobstore to send me a thumbnail of an image? The call needs to come from the android side.

Was it helpful?

Solution

You could use get_serving_url()

You can use it to generate a link to the image in the blobstore and can specify the size of its "longest dimension ... preserving the original aspect ratio":

images.get_serving_url(your_blob_key,size=300)

This will produce a URL like this: http://lh6.ggpht.com/iQLnaVoMEhOWzMummf_PzD8frysTBIP6FsTCYpEuf0FA8KaK72T0zreND_pi4vZyUJQvv72x_rXLisIJOiXbb2IWzBc=s300

As you can see, setting size=300 simply adds =s300 to the end of the URL, so you could skip adding this and just add =s300 to the url in your app.

Be aware that this creates a "Public but not guessable URL". This essentially means that anyone could potentially access the link generated if they have the URL.

The other issue with this is that you would need to generate the link from within App Engine. However if you NEED to be able to just access it directly through the app you could generate the link during upload and store this in the datastore along with the blobstore key. You could then send this link to the app, in-place of the existing link being sent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top