优化图片上传格式处理,新增svg格式

This commit is contained in:
zmister 2021-07-23 17:13:12 +08:00
parent a2060c8381
commit 310ca10e30
5 changed files with 8 additions and 5 deletions

View File

@ -19,6 +19,7 @@
- [优化]后台图片管理图片预览功能;
- [优化]文档历史记录对比接口;
- [优化]403页面
- [优化]图片上传格式处理;
### v0.6.8 2021-06-27

View File

@ -195,7 +195,7 @@ MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
# 允许上传的图片后缀
ALLOWED_IMG = ["jpg", "jpeg", "gif", "png", "bmp", "webp"]
ALLOWED_IMG = ["jpg", "jpeg", "gif", "png", "bmp", "webp","svg"]
REST_FRAMEWORK = {

View File

@ -51,7 +51,8 @@ def ice_save_file(file_obj,user):
# 默认保留支持ice单文件上传功能可以iceEditor中开启
file_suffix = str(file_obj).split(".")[-1] # 提取图片格式
# 允许上传文件类型ice粘贴上传为blob
allow_suffix =["jpg", "jpeg", "gif", "png", "bmp", "webp","blob"]
# allow_suffix =["jpg", "jpeg", "gif", "png", "bmp", "webp","blob"]
allow_suffix = settings.ALLOWED_IMG
# 判断附件格式
is_images = ["jpg", "jpeg", "gif", "png", "bmp", "webp"]
if file_suffix.lower() not in allow_suffix:
@ -185,7 +186,8 @@ def upload_generation_dir(dir_name=''):
# 普通图片上传
def img_upload(files, dir_name, user, group_id=None):
# 允许上传文件类型
allow_suffix =["jpg", "jpeg", "gif", "png", "bmp", "webp"]
# allow_suffix =["jpg", "jpeg", "gif", "png", "bmp", "webp","blob"]
allow_suffix = settings.ALLOWED_IMG
file_suffix = files.name.split(".")[-1] # 提取图片格式
# 判断图片格式
if file_suffix.lower() not in allow_suffix:

View File

@ -493,7 +493,7 @@ upload.render({
layer.closeAll('loading'); //关闭loading
layer.msg("系统异常,请稍后再试!")
},
accept: 'images', //允许上传的文件类型
accept: 'file', //允许上传的文件类型
acceptMime:'image/*',
field:'manage_upload',
});

View File

@ -235,7 +235,7 @@
layer.closeAll('loading'); //关闭loading
layer.msg("系统异常,请稍后再试!")
},
accept: 'images', //允许上传的文件类型
accept: 'file', //允许上传的文件类型
acceptMime:'image/*',
field:'manage_upload',