(cls, file_stream, size_key, metadata)
return ret
Given the image object and the size key, prepare the metadata calculations
        image_obj: Image object
        size_key: matching the image_size_map - if original calculate from origina lfilesize
Given the image object and the size key, prepare the metadata calculations
        image_obj: Image object
        size_key: matching the image_size_map - if original calculate from origina lfilesize
Given the image object and the size key prepare the metadata calculations image_obj : Image object size_key : matching the image_size_map - if original calculate from origina lfilesize
def make_meta(cls, file_stream, size_key, metadata):
        """
        Given the image object and the size key, prepare the metadata calculations
        image_obj: Image object
        size_key: matching the image_size_map - if original calculate from origina lfilesize
        """
        file_stream.seek(0)
        image_obj = Image.open(file_stream)

        if size_key == OBJECT_ORIGINAL:
            width, height = image_obj.size
        else:
            width = OBJECT_SIZE_MAP[size_key]['width']
            height = OBJECT_SIZE_MAP[size_key]['height']

        file_stream.seek(0, os.SEEK_END)
        content_length = file_stream.tell()
        file_stream.seek(0)

        content_type='application/octet-stream'
        for ctype_key in ['content_type', 'Content-Type']:
            content_type = metadata.get(ctype_key, None)
            if content_type is not None:
                break

        ret = cls(
            size_key=size_key,
            width=width,
            height=height,
            content_length=content_length,
            content_type=content_type
        )
        return ret
def make_meta ( cls , file_stream , size_key , metadata ) : file_stream . seek ( 0 ) image_obj = Image . open ( file_stream ) if size_key == OBJECT_ORIGINAL : width , height = image_obj . size else : width = OBJECT_SIZE_MAP [ size_key ] [ 'width' ] height = OBJECT_SIZE_MAP [ size_key ] [ 'height' ] file_stream . seek ( 0 , os . SEEK_END ) content_length = file_stream . tell ( ) file_stream . seek ( 0 ) content_type = 'application/octet-stream' for ctype_key in [ 'content_type' , 'Content-Type' ] : content_type = metadata . get ( ctype_key , None ) if content_type is not None : break ret = cls ( size_key = size_key , width = width , height = height , content_length = content_length , content_type = content_type ) return ret