How to configure imageresizer (imageresizing.net) to limit the number of scaled images

67 views Asked by At

In the common responsive web page scenario, the browser requests images at a size determined by the current browserwindow size, so the size requests for an image will be like:

image740?height=731
image740?height=911
image740?width=402
image740?width=403
image740?width=2203

To avoid caching of all those highly specific image sizes and to enhance cache utilization, I would like to set some predefined sizes that are created on the server size. So for instance all image requests between height 600 and 1200 would deliver an image with height 1200.

Q: Is it possible to configure imageresizer doing this? Q: Is enhancing the SizeLimiting plugin is a good place to implement this?

1

There are 1 answers

0
Lilith River On BEST ANSWER

The Presets plugin lets you define, well, presets, and use those exclusively.

The better solution, however, is to fix your client-side javascript to use intervals instead of the exact browser size. Slimmage.js does this by dividing the pixel count by a factor, rounding up, then multiplying by the same factor. 160 is a good factor that generates ~13 sizes under 2048.