Given is the follwing model on GAE:
avatar = db.BlobProperty()
By calling the image instance properties height or width (see documentation) with:
height = profile.avatar.height
the following error is thrown:
AttributeError: ‘Blob’ object has no attribute ‘height’
PIL is installed.
If the image is stored in a BlobProperty, then the data is stored in the datastore, and if
profileis your entity, then the height can be accessed as:If the image is in the blobstore, (blobstore.BlobReferenceProperty in the datastore), then you have 2 ways of doing it, the better way is complicated and requires getting a reader for the blob and feeding it to a exif reader to get the size. An easier way is:
if
avatar = db.BlobReferenceProperty()andprofileis your entity, then: