ryan
ryan

Reputation: 2331

Is there a way to overwrite existing Blobs in the blobstore

I'm using the high performance image serving feature in App Engine to serve up images from the blobstore. However, I'd like users to be able to modify those images (e.g. rotate, crop etc.) and then write those change back to the blobstore, overwriting the original blob. I know I can write to new blobs in the blobstore, as documented here: http://code.google.com/appengine/docs/python/blobstore/overview.html#Writing_Files_to_the_Blobstore

but I don't see a way to overwrite existing blobs. Is this possible in App Engine?

My use case is as follows:

  1. User uploads image, and app engine generates a link via get_serving_url
  2. The user may then use that link outside of my app, e.g. link to it on their blog to display the image
  3. If that image is changed later on in my app (rotation, etc.) , I'd like their image link to reflect those changes

Upvotes: 2

Views: 583

Answers (2)

Chung
Chung

Reputation: 975

I think you should try to build your own controller for generate file serving url - In Datastore each blobFile record have own ID (you manage it) and version ID - for first upload , set new ID and version - When user change your image, save new blobstore, keep ID and set new version field

In serving controller generate link by iD, when user call it, get the newest version for serving

It's just my opinion, hope it helpful !

Upvotes: 0

gregdarke
gregdarke

Reputation: 196

Files stored in blobstore are immutable, once they have been written than can not be changed (only served or deleted).

Upvotes: 7

Related Questions