Created
May 6, 2011 20:34
-
-
Save dinedal/959729 to your computer and use it in GitHub Desktop.
This file contains 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
def upload_sizing | |
result = {} | |
size = {:width => self.upload_width, :height => self.upload_height} | |
thumb_size = {:width => self.upload_thumb_width, :height => self.upload_thumb_height} | |
keys = [] | |
keys.push "resize" if self.enable_images? | |
keys.push "encode" if self.enable_videos? | |
keys.each do |key| | |
result[key.to_sym] = size if self.upload_width? && self.upload_height? | |
result["#{key}_thumb".to_sym] = thumb_size if self.upload_thumb_width? && self.upload_thumb_height? | |
end | |
result[:export][:use] = result.keys.collect { |key| key.to_s } | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment