छवि एक BlobProperty में जमा हो जाती है, तो डेटा डेटासंग्रह में संग्रहीत किया जाता है, और अगर profile
अपने इकाई है, तो ऊंचाई के रूप में पहुँचा जा सकता है: अगर छवि में है
from google.appengine.api import images
height = images.Image(image_data=profile.avatar).height
ब्लॉबस्टोर, (डेटाबोर में ब्लॉबस्टोर.ब्लोब रेफरेंसप्रोपर्टी), तो आपके पास इसे करने के 2 तरीके हैं, बेहतर तरीका जटिल है और इसे ब्लॉब के लिए पाठक प्राप्त करने और आकार प्राप्त करने के लिए इसे एक एक्फिफ़ रीडर को खिलााना आवश्यक है। एक आसान तरीका है:
avatar = db.BlobReferenceProperty()
अगर और profile
, तो अपनी इकाई है तो:
from google.appengine.api import images
img = images.Image(blob_key=str(profile.avatar.key()))
# we must execute a transform to access the width/height
img.im_feeling_lucky() # do a transform, otherwise GAE complains.
# set quality to 1 so the result will fit in 1MB if the image is huge
img.execute_transforms(output_encoding=images.JPEG,quality=1)
# now you can access img.height and img.width
तुम भी रूप में अच्छी तरह यहां बेहतर/जटिल विधि दिखा सकते हैं? – Lipis
वाह अद्भुत। मैं सोच रहा था कि मुझे चौड़ाई क्यों नहीं मिल सका –