Skip to content

Instantly share code, notes, and snippets.

@akasper
Forked from adorr/gist:959582
Created May 7, 2011 17:17
Show Gist options
  • Save akasper/960654 to your computer and use it in GitHub Desktop.
Save akasper/960654 to your computer and use it in GitHub Desktop.
def size_upload
result = {:export => {use: []}}
return result unless self.uploads_enabled?
result[:resize] = result[:encode] = {
width: self.upload_width,
height: self.upload_height
} if self.upload_width? && self.upload_height?
result[:resize_thumb] = result[:encode_thumb] = {
width: self.upload_thumb_width,
height: self.upload_thumb_height
} if self.upload_thumb_width? && self.upload_thumb_height?
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