简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM