1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-23 20:37:42 +00:00

preview heic img (#6700)

* preview heic img

* update

* Update requirements.txt

* Update utils.py

* Update requirements.txt

* update

---------

Co-authored-by: 孙永强 <11704063+s-yongqiang@user.noreply.gitee.com>
Co-authored-by: r350178982 <32759763+r350178982@users.noreply.github.com>
This commit is contained in:
awu0403
2024-09-12 07:51:52 +08:00
committed by GitHub
parent 19a32a8e2a
commit 86f720bff5
3 changed files with 9 additions and 1 deletions

View File

@@ -130,7 +130,7 @@ export const Utils = {
return false; return false;
} }
var file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase(); var file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
var image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'jfif']; var image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'jfif', 'heic'];
if (image_exts.indexOf(file_ext) != -1) { if (image_exts.indexOf(file_ext) != -1) {
return true; return true;
} else { } else {

View File

@@ -28,3 +28,4 @@ python-ldap==3.4.*
pypinyin==0.52.* pypinyin==0.52.*
PyMuPDF==1.24.* PyMuPDF==1.24.*
dnspython==2.6.* dnspython==2.6.*
pillow-heif==0.18.*

View File

@@ -15,6 +15,7 @@ except:
from urllib.request import urlretrieve from urllib.request import urlretrieve
from PIL import Image from PIL import Image
from seaserv import get_file_id_by_path, get_repo, get_file_size, \ from seaserv import get_file_id_by_path, get_repo, get_file_size, \
seafile_api seafile_api
@@ -23,6 +24,12 @@ from seahub.utils.file_types import VIDEO, XMIND, PDF
from seahub.settings import THUMBNAIL_IMAGE_SIZE_LIMIT, \ from seahub.settings import THUMBNAIL_IMAGE_SIZE_LIMIT, \
THUMBNAIL_EXTENSION, THUMBNAIL_ROOT, THUMBNAIL_IMAGE_ORIGINAL_SIZE_LIMIT,\ THUMBNAIL_EXTENSION, THUMBNAIL_ROOT, THUMBNAIL_IMAGE_ORIGINAL_SIZE_LIMIT,\
ENABLE_VIDEO_THUMBNAIL, THUMBNAIL_VIDEO_FRAME_TIME ENABLE_VIDEO_THUMBNAIL, THUMBNAIL_VIDEO_FRAME_TIME
try:
from pillow_heif import register_heif_opener
register_heif_opener()
except ImportError:
pass
# Get an instance of a logger # Get an instance of a logger
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)