Skip to content

Instantly share code, notes, and snippets.

@ZogStriP
Created May 27, 2015 18:00
Show Gist options
  • Save ZogStriP/8124585448e13ad8a254 to your computer and use it in GitHub Desktop.
Save ZogStriP/8124585448e13ad8a254 to your computer and use it in GitHub Desktop.
/original/1X/#{sha}#{extension}
/original/2X/#{sha[0]}/#{sha}#{extension}
/original/3X/#{sha[0]}/#{sha[1]}/#{sha}#{extension}
/original/4X/#{sha[0]}/#{sha[1]}/#{sha[2]}/#{sha}#{extension}
/optimized/1X/#{sha}_#{version}_#{width}x#{height}#{extension}
/optimized/2X/#{sha[0]}/#{sha}_#{version}_#{width}x#{height}#{extension}
/optimized/3X/#{sha[0]}/#{sha[1]}/#{sha}_#{version}_#{width}x#{height}#{extension}
/optimized/4X/#{sha[0]}/#{sha[1]}/#{sha[2]}/#{sha}_#{version}_#{width}x#{height}#{extension}
# of optimized images = avatar_sizes (6) * device_pixel_ratios (3)
avatar sizes:
- tiny
- small
- medium
- large
- extra_large
- huge
device pixel ratios
- 1 (normal displays)
- 2 (retina displays)
- 3 (iPhone 6+)
cf. http://bjango.com/articles/min-device-pixel-ratio/
BASED ON THE ID OF THE UPLOAD?
1X = 1 - 1 000
2X = 1 001 - 16 000
3X = 16 001 - 256 000
4X = 256 001 - 4 096 000
(0..4).map { |i| (16**i) * 1_000 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment