mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-10 16:46:50 +01:00
webp thumbnail support with png fallback
This commit is contained in:
parent
e4a26164de
commit
58f2c6a5fc
3 changed files with 15 additions and 5 deletions
|
|
@ -191,7 +191,7 @@ def make_thumbnail_from_pdf(in_path, temp_dir, logging_group=None) -> str:
|
|||
"""
|
||||
The thumbnail of a PDF is just a 500px wide image of the first page.
|
||||
"""
|
||||
out_path = os.path.join(temp_dir, "convert.png")
|
||||
out_path = os.path.join(temp_dir, "convert.webp")
|
||||
|
||||
# Run convert to get a decent thumbnail
|
||||
try:
|
||||
|
|
@ -321,7 +321,7 @@ class DocumentParser(LoggingMixin):
|
|||
|
||||
def get_optimised_thumbnail(self, document_path, mime_type, file_name=None):
|
||||
thumbnail = self.get_thumbnail(document_path, mime_type, file_name)
|
||||
if settings.OPTIMIZE_THUMBNAILS:
|
||||
if settings.OPTIMIZE_THUMBNAILS and os.path.splitext(thumbnail)[1] == ".png":
|
||||
out_path = os.path.join(self.tempdir, "thumb_optipng.png")
|
||||
|
||||
args = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue