Jump to content

Include image config settings in image variation filenames


Robin S
 Share

Recommended Posts

Currently ProcessWire names image variations like this: myimage.[width]x[height].jpg

But there are other image sizer config options that affect the image variation - namely upscaling, cropping and quality. If you change any of these config options after you have already generated an image variation at the same dimensions you don't see the result on the frontend, rather you get the old cached version.

There is a module that can clear image variations, but the problem could be avoided if the config options were included in the variation filename. Something like:

myimage.800x600.u-0.c-north.q-70.jpg

  • Like 2
Link to comment
Share on other sites

If you change options for image variations, you always can set "forceNew" => true, to force a recreation of the variation(s). This can be done everywhere, in line of code in a template to affect only those images, or in a module or even in site/config.php to force recreations for every variation on every page load site wide! (SO BE VERY CAREFULLY!) :)

You can also use PIA. She has an option for that sitewide setting to switch on and off. This also only takes affect for logged in admin users, and not for page views by guest users.

But I like the idea! I also have had a module (or proof of concept) that supported it, but it worked only with PW 2.4. and stopped working with all the changes on pageimage / imagesizer introduced in PW 2.5+

One minor thing: cropping is reflected in the variation names by the current core! Only upscaling, quality and sharpening is missing!

Edited by horst
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...