Adaptive-Images icon indicating copy to clipboard operation
Adaptive-Images copied to clipboard

Only use preset resolutions for image calculations

Open zorker opened this issue 11 years ago • 3 comments

Script is changed to pick a resolution that best matches the resolutions found in the resolution array. Thus fewer images need to be generated. DPI is factored in. If your max resolution is 480 and your DPI is 2 and you have a value in the array of 1024 it will pick 1024 because it is the closest value that is still >= "test".

Additionally changed the cache folder to use /$resolution/hash as the cache file.

zorker avatar Jan 22 '14 08:01 zorker

Thanks for this! It works great :) Finally i got rid of my problems... #106

discotizer avatar Jan 31 '14 09:01 discotizer

@zorker I'm experiencing an issue with Retina iPads: Holding it in portrait mode (768px width) i'm displaying a picture in 752px width, now with dpi=2 it should deliver a picture with 1504px but it doesnt. My highest breakpoint is 1200, according to the css. Should i therefore define another breakpoint that is higher? I already have image folders with 1800 and 2400 so i think i should add them to the breakpoint list, right?

discotizer avatar Feb 20 '14 08:02 discotizer

@discotizer In the end it depends on the image you want to display. The image has to be big enough to be scaled down. If no matching breakpoint could be found he will use the original image. You can easily debug which image is delivered by calling sendErrorImage in the sendImage function. You will get a debug image with all the information you need. If you already have higher breakpoint folders you should add them.

Btw...you can debug this in Chrome aswell because when zooming in Chrome (CTRL+scrollwheel) Chrome will keep window size and change the DPI. Firefox does the same but sadly it shrinks/increases the window size aswell so the endresult is the same image size.

zorker avatar Feb 20 '14 08:02 zorker