Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images from storage are not normalized (not respecting MAX_WIDTH / MAX_HEIGHT) #1547

Closed
thomas-brx opened this issue Jan 27, 2023 · 2 comments · Fixed by #1548
Closed

Images from storage are not normalized (not respecting MAX_WIDTH / MAX_HEIGHT) #1547

thomas-brx opened this issue Jan 27, 2023 · 2 comments · Fixed by #1548

Comments

@thomas-brx
Copy link
Contributor

Assuming STORAGE is configured, for example:

STORAGE = 'tc_redis.storages.redis_storage'

Thumbor request URL

During the first load, engine.normalize() is called to ensure the image is limited in size by MAX_{WIDTH,HEIGHT}.

During the second load, the raw data of the image is loaded from storage (redis in this case), but engine.normalize() will not be called.

Expected behaviour

Images loaded should be identical for identical requests.

Perhaps the normalized version of the image is what should be stored in the storage?

Normalization happens here:
https://github.com/thumbor/thumbor/blob/master/thumbor/handlers/__init__.py#L933

A successful fetch from storage returns here:
https://github.com/thumbor/thumbor/blob/master/thumbor/handlers/__init__.py#L880

The output below shows the log for 2 identical image requests, the first is a cache miss, the second is a cache hit.

inc: storage.miss:1
[...]
inc: response.bytes.jpg:129357

inc: storage.hit:1
[...]
inc: response.bytes.jpg:405529
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove the stale label or add a comment, or this issue will be closed in 15 days. You can always re-open if you still feel this is still an issue. Tag @heynemann for more information.

@github-actions github-actions bot added the Stale label Feb 27, 2023
@github-actions
Copy link

This issue was closed because it has been stale for 15 days with no activity.

@RaphaelVRossi RaphaelVRossi reopened this Jun 29, 2023
@devppjr devppjr linked a pull request Jul 14, 2023 that will close this issue
@devppjr devppjr closed this as completed Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants