carrierwave

https://github.com/carrierwaveuploader/carrierwave

Ruby

Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks

CarrierWave::Uploader::Processing::ClassMethods#process

Adds a processor callback which applies operations as a file is uploaded.
The argument may be the name of any method of the uploader, expressed as a symbol,
or a list of such methods, or a hash where the key is a method and the value is
an array of arguments to call the method with

=== Parameters

args (*Symbol, Hash{Symbol => Array[]})

=== Examples

    class MyUploader < CarrierWave::Uploader::Base

      process :sepiatone, :vignette
      process :scale => [200, 200]
      process :scale => [200, 200], :if => :image?
      process :sepiatone, :if => :image?

      def sepiatone
        ...
      end

      def vignette
        ...
      end

      def scale(height, width)
        ...
      end

      def image?
        ...
      end

    end

Source | Google | Stack overflow

Edit

git clone [email protected]:carrierwaveuploader/carrierwave.git

cd carrierwave

open lib/carrierwave/uploader/processing.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-CarrierWave--Uploader--Processing--ClassMethods-process-for-pr


# Commit to git

git add lib/carrierwave/uploader/processing.rbgit commit -m "better docs for CarrierWave::Uploader::Processing::ClassMethods#process"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-CarrierWave--Uploader--Processing--ClassMethods-process-for-pr

hub pull-request


# Celebrate!