Search code examples
pythongoogle-app-engineblobstoreplupload

Retrieving metadata of a photo saved to blobstore


I am uploading a photo to blobstore using plupload. The BlobInfo object has some metadata

content_type: The content type of the blob.
creation: The creation date of the blob, or when it was uploaded.
filename: The file name that the user selected from their machine.
size: The size of the uncompressed blob.
md5_hash: The MD5 hash value of the uploaded blob.

My question is how can I get the other metadata of the photo either from plupload or serverside? Specifically, there is a metadata field of "description" that I need to retrieve.


Solution

  • I would use exif-py as follows:

    blob_reader = blobstore.BlobReader(blob_key)
    blob_reader_data = StringIO.StringIO(blob_reader.read())
    tags = exifread.process_file(blob_reader_data)
    

    the tags object it returns contain the metadata you're looking for.