Now with more high-res photo support.
This commit is contained in:
@@ -84,6 +84,36 @@ THUMBNAIL_FILES: dict[str, bytes] = {}
|
|||||||
TEMP_FILE_EXPIRY = 300 # 5 minutes
|
TEMP_FILE_EXPIRY = 300 # 5 minutes
|
||||||
THUMBNAIL_SIZE = (250, 250) # Maximum dimensions for thumbnail
|
THUMBNAIL_SIZE = (250, 250) # Maximum dimensions for thumbnail
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# CONFIGURATION
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
# Override stegasoo limits for larger files
|
||||||
|
# Note: You might need to modify the stegasoo library itself
|
||||||
|
# to actually increase these limits in its internal calculations
|
||||||
|
|
||||||
|
# Flask upload limit (30MB)
|
||||||
|
MAX_UPLOAD_SIZE = 30 * 1024 * 1024
|
||||||
|
|
||||||
|
# Try to import and override stegasoo constants if possible
|
||||||
|
try:
|
||||||
|
# Check current limits
|
||||||
|
print(f"Current MAX_FILE_SIZE from constants: {MAX_FILE_SIZE}")
|
||||||
|
print(f"Current MAX_FILE_PAYLOAD_SIZE: {MAX_FILE_PAYLOAD_SIZE}")
|
||||||
|
|
||||||
|
# Try to increase payload size limit (in bytes)
|
||||||
|
# 15MB should be enough for 7.6MB files with overhead
|
||||||
|
DESIRED_PAYLOAD_SIZE = 15 * 1024 * 1024 # 15MB
|
||||||
|
|
||||||
|
# Note: You might need to patch the stegasoo module
|
||||||
|
# if MAX_FILE_PAYLOAD_SIZE is used internally
|
||||||
|
import stegasoo
|
||||||
|
if hasattr(stegasoo, 'MAX_FILE_PAYLOAD_SIZE'):
|
||||||
|
print(f"Overriding MAX_FILE_PAYLOAD_SIZE to {DESIRED_PAYLOAD_SIZE}")
|
||||||
|
stegasoo.MAX_FILE_PAYLOAD_SIZE = DESIRED_PAYLOAD_SIZE
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Could not override stegasoo limits: {e}")
|
||||||
|
|
||||||
def generate_thumbnail(image_data: bytes, size: tuple = THUMBNAIL_SIZE) -> bytes:
|
def generate_thumbnail(image_data: bytes, size: tuple = THUMBNAIL_SIZE) -> bytes:
|
||||||
"""Generate thumbnail from image data."""
|
"""Generate thumbnail from image data."""
|
||||||
@@ -737,4 +767,4 @@ def about():
|
|||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=5000, debug=False)
|
app.run(host='0.0.0.0', port=5000, debug=False)
|
||||||
|
|||||||
@@ -44,11 +44,13 @@ PBKDF2_ITERATIONS = 600000
|
|||||||
# INPUT LIMITS
|
# INPUT LIMITS
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
MAX_IMAGE_PIXELS = 16_000_000 # ~16 megapixels (4000x4000)
|
MAX_IMAGE_PIXELS = 24_000_000 # ~24 megapixels
|
||||||
MAX_MESSAGE_SIZE = 250_000 # 250 KB (text messages)
|
MAX_MESSAGE_SIZE = 250_000 # 250 KB (text messages)
|
||||||
MAX_FILE_PAYLOAD_SIZE = 250_000 # 250 KB (file payloads)
|
|
||||||
MAX_FILENAME_LENGTH = 255 # Max filename length to store
|
MAX_FILENAME_LENGTH = 255 # Max filename length to store
|
||||||
MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB (upload limit)
|
|
||||||
|
# Example in constants.py
|
||||||
|
MAX_FILE_SIZE = 30 * 1024 * 1024 # 30MB total file size
|
||||||
|
MAX_FILE_PAYLOAD_SIZE = 2 * 1024 * 1024 # 2MB payload
|
||||||
|
|
||||||
MIN_PIN_LENGTH = 6
|
MIN_PIN_LENGTH = 6
|
||||||
MAX_PIN_LENGTH = 9
|
MAX_PIN_LENGTH = 9
|
||||||
|
|||||||
BIN
test_data/qr_scan.jpg
Normal file
BIN
test_data/qr_scan.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 MiB |
Reference in New Issue
Block a user