admins.py 文件源码

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

项目:MagicPress 作者: huang-zp 项目源码 文件源码
def editor_pic(self):
        image_file = request.files['editormd-image-file']
        if image_file and allowed_photo(image_file.filename):
            try:
                filename = secure_filename(image_file.filename)
                filename = str(date.today()) + '-' + random_str() + '-' + filename
                file_path = os.path.join(bpdir, 'static/editor.md/photoupdate/', filename)
                qiniu_path = os.path.join(bpdir, 'static/blog/qiniu_pic/', filename)
                image_file.save(file_path)
                ting_pic(file_path, qiniu_path)
                qiniu_link = get_link(qiniu_path, filename)
                data = {
                    'success': 1,
                    'message': 'image of editor.md',
                    'url': qiniu_link
                }
                return json.dumps(data)
            except Exception as e:
                current_app.logger.error(e)
        else:
            return u"??????????????"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号