feat: reduce maximum image processing and upload dimensions to 1080.

This commit is contained in:
Suherdy Yacob 2026-02-24 11:19:03 +07:00
parent 34a7869f91
commit dd7b43ec8c
2 changed files with 4 additions and 4 deletions

View File

@ -45,9 +45,9 @@ class SignController(Sign):
# Decode # Decode
image_bytes = base64.b64decode(image_data) image_bytes = base64.b64decode(image_data)
# Process image: limit size to max 1920x1920 and reasonable quality # Process image: limit size to max 1080x1080 and reasonable quality
# image_process returns the processed image binary # image_process returns the processed image binary
processed_image = image_process(image_bytes, size=(1920, 1920), quality=80, output_format='JPEG') processed_image = image_process(image_bytes, size=(1080, 1080), quality=80, output_format='JPEG')
# Re-encode # Re-encode
new_base64 = base64.b64encode(processed_image).decode('utf-8') new_base64 = base64.b64encode(processed_image).decode('utf-8')

View File

@ -57,8 +57,8 @@ patch(SignablePDFIframe.prototype, {
let width = img.width; let width = img.width;
let height = img.height; let height = img.height;
// Calculate new dimensions (e.g., max width/height 1920 to keep it reasonable) // Calculate new dimensions (e.g., max width/height 1080 to keep it reasonable)
const MAX_SIZE = 1920; const MAX_SIZE = 1080;
if (width > height) { if (width > height) {
if (width > MAX_SIZE) { if (width > MAX_SIZE) {
height *= MAX_SIZE / width; height *= MAX_SIZE / width;