Phone4 has retina display which requires higher resolution images and
doesn't always scale down images nicely. Our iOS guys asked us to
follow some conventions that has a regular called foo.png have its
retina version named f...@2x.png (under the same path of course.)
We also where hoping our models could support this via carrierwave
like so:
class Person < ActiveRecord::Base
mount_uploader :headshot, IPhoneImageUploader
end
person.headshot.url => /uploads/person/headshot/1/
foo.png (Resolution 200 x 200)
person.headshot.url(:retina) => /uploads/person/headshot/1/
f...@2x.png (Resolution 400 x 400)
https://gist.github.com/d5e183384ee30658975f is a working Uploader
which has a few small hacks to make this all happen. Also in the gist
I outlined the problem and a few notes as I worked through things to
get the hacks going.
I am wondering if anyone has already dealt with this, or is in the
process of doing something with iOS images for retina displays?
I will likely start to extract the version naming into one place and
use the the current implementation as a default strategy, and provide
the ability to override in your uploader with out feeling as hacky as
the gsubs in the gist are. I am also considering adding an option to
the version method to facilite using the new_file instead of
processed_parent in the cache_versions! method as mentioned in the
gist. These two refactors should allow for the uploader in the gist
work with out the hacks.
If anyone has any addition ideas, or simply knows the code base better
and wants to put in their 2 cents please let me know.