The worker decodes the original once (JPEG draft down to the optimized box, EXIF orientation applied in place, alpha composed on white) and encodes three variants: the 256 px thumbnail, a centred 128x128 JPEG crop that may upscale and a WebP fitted into 1280x1280 without upscaling, quality 80, method 4. No EXIF, ICC or XMP is written. The byte limit is checked before decoding. ready is set by the transaction that stores all three rows, so a partial set is never published. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
42 lines
565 B
Python
42 lines
565 B
Python
from messenger.shared.domain.errors import DomainError
|
|
|
|
|
|
class AttachmentError(DomainError):
|
|
pass
|
|
|
|
|
|
class InvalidFilename(AttachmentError):
|
|
pass
|
|
|
|
|
|
class UnsupportedImage(AttachmentError):
|
|
pass
|
|
|
|
|
|
class PayloadTooLarge(AttachmentError):
|
|
pass
|
|
|
|
|
|
class ChatNotFound(AttachmentError):
|
|
pass
|
|
|
|
|
|
class AttachmentNotFound(AttachmentError):
|
|
pass
|
|
|
|
|
|
class AttachmentNotReady(AttachmentError):
|
|
pass
|
|
|
|
|
|
class UploadAborted(AttachmentError):
|
|
pass
|
|
|
|
|
|
class UnreadableImage(AttachmentError):
|
|
pass
|
|
|
|
|
|
class ImageTooDemanding(AttachmentError):
|
|
pass
|