From 2dcfbd784c132dd05b4b23b2d0fe67b8814f3d68 Mon Sep 17 00:00:00 2001 From: KevinHuSh Date: Fri, 17 May 2024 14:04:21 +0800 Subject: [PATCH] fix too large thumbnail issue (#817) ### What problem does this PR solve? #709 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/utils/file_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/utils/file_utils.py b/api/utils/file_utils.py index a062b93eed..ab859aaba3 100644 --- a/api/utils/file_utils.py +++ b/api/utils/file_utils.py @@ -174,7 +174,7 @@ def thumbnail(filename, blob): if re.match(r".*\.pdf$", filename): pdf = pdfplumber.open(BytesIO(blob)) buffered = BytesIO() - pdf.pages[0].to_image().annotated.save(buffered, format="png") + pdf.pages[0].to_image(resolution=32).annotated.save(buffered, format="png") return "data:image/png;base64," + \ base64.b64encode(buffered.getvalue()).decode("utf-8")