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)
This commit is contained in:
KevinHuSh 2024-05-17 14:04:21 +08:00 committed by GitHub
parent 2dd705fe68
commit c3bc72dfd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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")