- Where Developers Learn, Share, & Build Careers


I am uploading an image file on the server and resizing it to save the disk space in the datastore. My method of resizing and then removing the original blob and keeping the small version of the blob all the metadata removed. Is there a way to copy Blob metadata from the original blob and copy it to a smaller version?

  def (self): upload_files = self.get_uploads ('file') blob_info = Upload_files [0] if blob_info: img = images.image (blob_key = blob_info) img.im_feeling_lucky () Img.resize (width = 600, height = 800) smallVersion = img.execute_transforms (output_encoding = images.JPEG) file_name = files with files.open (file_name, 'a') blobstore.create (mime_type = 'image / jpeg' ) F: In the form of f.write (smallVersion) files. Finalize (file_name) blob_key = files.blobstore.get_blob_key (file_name) blobstore Delete (blob_info.key ()) blobCacheURL = images.get_serving_url (blob_key)    

when If you create a Blob with the file API, you can set the uploaded file name:

  file_name = files.blobstore.create (mime_type = 'image / png', _blobinfo_uploaded_filename = File_name_from_url)   

I'm not aware of other blob properties, you can set n write a file Are you looking for other properties near mime_type?

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -