Skip to content

Commit

Permalink
thumbnail lambda: allow to override PIL.Image.MAX_IMAGE_PIXELS (#4100)
Browse files Browse the repository at this point in the history
  • Loading branch information
sir-sigurd authored Aug 16, 2024
1 parent 01c5493 commit bf28589
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lambdas/thumbnail/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

Changes are listed in reverse chronological order (newer entries at the top).
The entry format is

```markdown
- [Verb] Change description ([#<PR-number>](https://github.com/quiltdata/quilt/pull/<PR-number>))
```

where verb is one of

- Removed
- Added
- Fixed
- Changed

## Changes

- [Added] Allow overriding PIL.Image.MAX_IMAGE_PIXELS using env var ([#4100](https://github.com/quiltdata/quilt/pull/4100))
5 changes: 5 additions & 0 deletions lambdas/thumbnail/src/t4_lambda_thumbnail/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
from t4_lambda_shared.decorator import QUILT_INFO_HEADER, api, validate
from t4_lambda_shared.utils import get_default_origins, make_json_response

# See https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.open.
# Use 0 to disable the limit.
if _MAX_IMAGE_PIXELS := os.environ.get("MAX_IMAGE_PIXELS"):
Image.MAX_IMAGE_PIXELS = int(_MAX_IMAGE_PIXELS) or None

# Eventually we'll want to precompute/cache thumbnails, so we won't be able to support
# arbitrary sizes. Might as well copy Dropbox' API:
# https://www.dropbox.com/developers/documentation/http/documentation#files-get_thumbnail
Expand Down

0 comments on commit bf28589

Please sign in to comment.