images usage patterns

62 views
Skip to first unread message

Frank Grossman

unread,
Jun 23, 2016, 10:10:48 PM6/23/16
to Google App Engine
I have a question using the google.appengine.api.images api.  I current generate a URL using images.get_serving_url when I upload an image.  I then store the URL in the datastore along with the Blob key.  I then just use the URL for displaying all the images.  This website has been up for years and just recently many of the URLs are getting 404s.  I can re-generate the URLs from the Blob keys.  But wondering if there is a usage pattern that I am missing? Do these URLs have a lifetime on them?

Nick (Cloud Platform Support)

unread,
Jun 27, 2016, 3:53:19 PM6/27/16
to Google App Engine
Hey Frank,

It appears the URLs are indeed going stale if 404's are served. Generally, the pattern is meant to be used to generate a serving URL on the fly. You could write up a quick request handler which receives a request for the image, uses its blobkey to generate a serving URL, then sends a 302 redirect response to that URL, which would resolve the issue.

Let me know if you have any further questions on top of this, I'll be happy to help.

Regards,

Nick
Cloud Platform Community Support

Nick (Cloud Platform Support)

unread,
Jun 27, 2016, 3:55:10 PM6/27/16
to Google App Engine
As an extra point to add aside from the original question, Cloud Storage serving URLs are absolutely stable. You could also consider migrating the objects into Cloud Storage.


On Thursday, June 23, 2016 at 10:10:48 PM UTC-4, Frank Grossman wrote:

Frank Grossman

unread,
Jul 4, 2016, 3:06:00 PM7/4/16
to Google App Engine
Thank you Nick,

I made a routine to refresh URLs. Looks like the stale one were all from back in 2010. I will look at Cloud Storage for a future port.

Frank

Nick (Cloud Platform Support)

unread,
Jul 5, 2016, 2:45:42 PM7/5/16
to Google App Engine
Glad to hear you got it working, Frank! Best of luck in your future work.
Reply all
Reply to author
Forward
0 new messages