file.attachments
Attributes
Classes
dict() -> new empty dictionary |
|
Functions
|
|
|
|
|
Resize an image so that neither dimension exceeds max_size. |
|
|
|
|
|
Module Contents
- class file.attachments._ImageSaveOptionalParams[source]
Bases:
TypedDictdict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- file.attachments.strip_exif_and_store_image_size(file: ProcessedUploadedFile, content: IO[bytes], content_type: str | None) IO[bytes] | None[source]
- file.attachments.resize_image(content: IO[bytes], max_size: int = IMAGE_MAX_SIZE) IO[bytes][source]
Resize an image so that neither dimension exceeds max_size.
When a resize is performed the EXIF orientation is baked in and the EXIF block is stripped in the same pass, so the depot processor’s EXIF-stripping step becomes a no-op and the image is only encoded once.
Non-image streams and images that are already within the limit are returned unchanged (seeked to 0). Large images are resampled into a new SpooledTemporaryFile.
- file.attachments.store_checksum(file: ProcessedUploadedFile, content: IO[bytes], content_type: str | None) None[source]
- file.attachments.sanitize_svg_images(file: ProcessedUploadedFile, content: IO[bytes], content_type: str | None) IO[bytes][source]
- file.attachments.store_extract_and_pages(file: ProcessedUploadedFile, content: IO[bytes], content_type: str | None) None[source]