Created
January 9, 2013 19:13
-
-
Save 0xGGGGG/4495956 to your computer and use it in GitHub Desktop.
retina carrierwave uploader snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
:thumb => [142, 106], | |
:box_iphone => [296, 222], | |
:box_normal => [219, 164], | |
:box_large => [450, 340], | |
:normal => [600, 450] | |
}.each do |name, dimensions| | |
retina_name = "#{name}_retina" | |
version retina_name do | |
process resize_to_fill: [ dimensions[0] * 2, dimensions[1] * 2 ] | |
def full_filename(for_file = model.file.file) | |
parent_name = super(for_file) | |
ext = File.extname(parent_name) | |
base_name = parent_name.chomp(ext) | |
[base_name, "@2x"].compact.join('') + ext | |
end | |
end | |
version name do | |
process resize_to_fill: dimensions | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment