Created
May 6, 2011 19:13
-
-
Save adorr/959582 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 = {:export => {use: []}} | |
return result unless self.uploads_enabled? | |
if self.upload_width? && self.upload_height? | |
if self.enable_images? | |
result[:resize] = { | |
width: self.upload_width, | |
height: self.upload_height | |
} | |
end | |
if self.enable_videos? | |
result[:encode] = { | |
width: self.upload_width, | |
height: self.upload_height | |
} | |
end | |
end | |
if self.upload_thumb_width? && self.upload_thumb_height? | |
if self.enable_images? | |
result[:resize_thumb] = { | |
width: self.upload_thumb_width, | |
height: self.upload_thumb_height | |
} | |
end | |
if self.enable_videos? | |
result[:encode_thumb] = { | |
width: self.upload_thumb_width, | |
height: self.upload_thumb_height | |
} | |
end | |
end | |
result[:export][:use].push("resize").push("resize_thumb") if self.enable_images? | |
result[:export][:use].push("encode").push("encode_thumb") if self.enable_videos? | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/959622