- 
                Notifications
    
You must be signed in to change notification settings  - Fork 672
 
Description
I see you already have similar issues #9 and #16 but since my post is quite elaborate, I would like make a separate request. I agree with @Reyncor that the retina method is too rigid in a world of responsive designs, and there are additional reasons by example:
In a responsive design, I might have a default 800 px wide image, that scales down to 320 px on an iPhone 5. The image will therefore already be retina-ready for the iPhone and I don't want to load a 2x file for this device. However, for devices like iPad 3, it would make sense to load a 2x file. In another scenario, I might have thumbnails in columns where I in fact do want to load 2x for all retina devices. What does this mean? Simply put, it means we don't really want the retina alone to dictate what image we should be loading. There are two solutions:
Media-query-like data-src
I have done a lot of research on how others are solving this problem, and by far the best and most flexible solution I came across is the Interchange plugin from Zurb, which uses media queries directly in the data-src:
data-interchange="[/path/to/default.jpg, (only screen and (min-width: 1px))], [/path/to/bigger-image.jpg, (only screen and (min-width: 1024px) and (min-device-pixel-ratio: 2))]"This allows full flexibility to load multiple image-sizes based on device screen size, pixel-ratio and orientation. http://foundation.zurb.com/docs/components/interchange.html
Multiplier
In many cases for images in responsive designs, a threshold value can be calculated by pixel-ratio * device-width. However, this method is not flexible and only applies to certain scenarios.
I prefer to avoid being limited to naming conventions for different file-sizes, because I use a CMS with an image processor where images can be called by URI like this '/render/w730-h-c3:2-q95//file.jpg'. This is one of the reasons I liked unveil in the first place, because we can set names independently.
I know unveil is supposed to be simple, and I wouldn't normally request such a nice simple plugin to do more than it is supposed to. However, the image-switching mechanism is a single process, and you can't really have multiple scripts competing to set the image src! Right now, I am using a custom unveil JS adapted to work in similar fashion as method 1 above.
Thanks!