Skip to content

Only use preset resolutions for image calculations#139

Open
zorker wants to merge 1 commit intoMattWilcox:masterfrom
zorker:patch-1
Open

Only use preset resolutions for image calculations#139
zorker wants to merge 1 commit intoMattWilcox:masterfrom
zorker:patch-1

Conversation

@zorker
Copy link
Copy Markdown

@zorker zorker commented Jan 22, 2014

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.

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.
@discotizer
Copy link
Copy Markdown

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

@discotizer
Copy link
Copy Markdown

@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?

@zorker
Copy link
Copy Markdown
Author

zorker commented Feb 20, 2014

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants