"Offline" resizing of images used by the {% image %} tag
See original GitHub issueProblem
Images are resized during the request processing, if they do not exist yet. I’m currently having issues with this. Imagine users upload a batch of images, which are shown publicly in a grid. During the rendering of that grid, all those images need to be resized on the fly. If you are working with a slow file backend (e.g. Amazon S3), the resulting loading time isn’t acceptable.
Proposal 1
Have a manage.py
command which:
- parses all templates for
{% image %}
tags to get required sizes - resize all images and store them to the file backend
This command would be executed manually.
Proposal 2
Do required resizing during the upload of an image. It would probably be necessary to specify required image sizes beforehand.
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
How to Resize an Image (Online or Offline) - WinBuzzer
Open your image, press the three dots in the toolbar, then click “Resize”.
Read more >Top 5 Image Resizers of 2022: Online and Offline Options
1. Icecream Image Resizer – easy to use image resizer with GUI · Resize images in a bulk · Feature to add watermark...
Read more >How to resize an image in HTML? - ImageKit.io
One of the simplest ways to resize an image in the HTML is using the height and width attributes on the img tag....
Read more >Quickly Resize Images With This Free Offline Tool - I Have A PC
Image Resizer is a free offline tool for resizing images. Here is how to use it.
Read more >Dynamic image resizing. - javascript - Stack Overflow
As Guffa said, using the width and height attributes of the image tag just affects the way it is displayed by the browser....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I like proposal 2, resizing images during upload. If a list of common image sizes/filters was defined in the settings, the images could be processed through these filters ready for use in the rest of the site. Additionally, if these predefined filters were given a name, they could be used as a filter spec, keeping templates DRY:
Just another thought:
What about setting a custom Image Model with the settings.WAGTAILIMAGES_IMAGE_MODEL and in that CustomImage class, override get_rendition, and when the proper rendition does not exist yet, start a celery that executes the original get_rendition method. And return the original image in the meanwhile (ok, maybe that screws the layout a bit)…