utils.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:django-content-gallery 作者: Kemaweyan 项目源码 文件源码
def get_image_in_memory_data():
    """
    Creates the InMemoryUploadedFile object using thedata from io
    to save it into the ImageField of the database
    """
    io = get_image_data()  # get a red rectangle 200x200px
    # create the InMemoryUploadedFile object with the 'foo.jpg' file
    image_file = InMemoryUploadedFile(io, None, 'foo.jpg', 
                            'jpeg', sys.getsizeof(io), None)
    image_file.seek(0)  # seek to the beginning
    return image_file
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号