Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow non-argument options to be passed in mini magick combine_options #2097

Conversation

krismartin
Copy link
Contributor

When a non-argument option is passed to mini magick processing using combine_options, the processing fails.

For example:

resize_to_fill(320, 320, combine_options: {strip: nil})

generates this command:

mogrify -resize 320 -gravity Center -background rgba(255,255,255,0.0) -strip  /var/folders/1_/tdx0fnfx32g1hqv94s3ttkw00000gn/T/mini_magick20170113-86521-eezfq7.jpg

But processing is failing with mini_magick_processing_error. Changing strip: nil to strip: "" (empty string) also did not solve the problem.

The only way I can get it to work is by changing the append_combine_options method to invoke the method without any arguments if nil options is passed:

def append_combine_options(cmd, combine_options)
    combine_options.each do |method, options|
        if options.nil?
            cmd.send(method)
        else
            cmd.send(method, options)
        end
    end
end

@mshibuya mshibuya merged commit a504ec9 into carrierwaveuploader:master Mar 5, 2017
@mshibuya
Copy link
Member

mshibuya commented Mar 5, 2017

Sounds good, thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants