Sha256: 9c5613eeda3d5d98e25381050f7800ffcfc0a399d769008155fd76a08ea27223

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

module Kanoko
  module Application
    class Convert
      # You can make customize function.
      # It just make or overwhrite instance method.
      # example:
      #   class Kanoko::Application::Convert::Function
      #     # get "/new_func/new_value"
      #     # => add imagemagick option
      #     # -new-option new_value
      #     def new_func(arg)
      #       ['-new-option', arg]
      #     end
      #   end
      class Function
        class << self
          def list
            instance_methods(false)
          end
        end

        def crop(arg)
          [
            '-crop', arg
          ]
        end

        def fill(arg)
          [
            '-gravity', 'north',
            '-extent', arg,
            '-background', 'transparent',
          ]
        end

        def resize(arg)
          [
            '-define', "jpeg:size=#{arg}",
            '-thumbnail', arg,
          ]
        end

        def auto_orient
          [
            '-auto-orient',
          ]
        end

        def strip
          [
            '-strip',
          ]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kanoko-0.3.3 lib/kanoko/application/convert/function.rb
kanoko-0.3.2 lib/kanoko/application/convert/function.rb
kanoko-0.3.1 lib/kanoko/application/convert/function.rb
kanoko-0.3.0 lib/kanoko/application/convert/function.rb