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
SIZING_METHODS = {:enable_images? => :resize, :enable_videos? => :encode} | |
def size_upload | |
result = {:export => {use: []}} | |
return result unless self.uploads_enabled? | |
['', '_thumb'].each do |insert| | |
w = "upload#{insert}_width".to_sym | |
w? = "#{w}?".to_sym |
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 = {} | |
if uploads_enabled? | |
dims = lambda {|size| send("upload#{size}_width?") && send("upload#{size}_width?") ? | |
{ width: send("upload#{size}_width"), height: send("upload#{size}_width") } : nil | |
} | |
{:enable_images? => :resize, :enable_videos? => :encode}.each do |method, result_key| | |
['', '_thumb'].each do |size| |