Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/imageproxy/convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(options, settings={})
@settings = settings

if (!(options.resize || options.thumbnail || options.rotate || options.flip || options.format ||
options.quality || options.overlay))
options.quality || options.overlay || options.crop))
raise "Missing action or illegal parameter value"
end
end
Expand Down Expand Up @@ -41,6 +41,7 @@ def try_command_with_timeout cmd

def convert_options
convert_options = []
convert_options << "-crop #{crop_thumbnail_options(options.crop)}" if options.crop
convert_options << "-resize #{resize_thumbnail_options(options.resize)}" if options.resize
convert_options << "-thumbnail #{resize_thumbnail_options(options.thumbnail)}" if options.thumbnail
convert_options << "-flop" if options.flip == "horizontal"
Expand All @@ -52,6 +53,10 @@ def convert_options
convert_options.join " "
end

def crop_thumbnail_options(crop_settings)
crop_settings.gsub(" ", "+")
end

def resize_thumbnail_options(size)
case options.shape
when "cut"
Expand Down