Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Process your Paperclip attachments in the background with delayed_job or Resque.

This branch is 2 commits ahead of aguilarsoto:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
gemfiles update gemfiles
lib move most_appropriate url to url generator not attachment
test Preventing endless loop when Rails callbacks are run.
.gitignore Ignore some more files
.rvmrc Modernize Tooling
.travis.yml Less appraisals for travis to run
Appraisals Compatibility with paperclip 2.4.1
CONTRIBUTING Updating test command documentation, to by default use the command th…
Gemfile Bump gemfile dependency to 2.7
LICENSE License and readme formatting
README.textile Delayed::Job.work_off is deprecated - use new method instead
Rakefile Trying to get some continuous testing up and running. Taking papercli…
delayed_paperclip.gemspec Version bump to
init.rb Making delayed_paperclip play nice with Railties, loading always afte…



Delayed_paperclip lets you process your Paperclip attachments in a background task with delayed_job or Resque.


The most common use case for Paperclip is to easily attach image files to ActiveRecord models. Most of the time these image files will have multiple styles and will need to be resized when they are created. This is usually a pretty slow operation and should be handled in a background task.

I’m sure that everyone knows this, this gem just makes it easy to do.


Install the gem:

sudo gem install delayed_paperclip

Add it to your environment.rb:

config.gem 'delayed_paperclip'

Or, even better, to your Gemfile:

source ""
gem 'delayed_paperclip'

Or install as a rails plugin:

script/plugin install git://


  • Paperclip
  • DJ or Resque


In your model:

  class User < ActiveRecord::Base
    has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }

    process_in_background :avatar

Use your Paperclip attachment just like always in controllers and views.

To select between using Resque or Delayed::Job, just install and configure your choice properly within your application, and delayed_paperclip will do the rest. It will detect which library is loaded and make a decision about which sort of job to enqueue at that time.


Make sure that you have Resque up and running. The jobs will be dispatched to the :paperclip queue, so you can correctly dispatch your worker. Configure resque and your workers exactly as you would otherwise.


Just make sure that you have DJ up and running.

Displaying images during processing

In the default setup, when you upload an image for the first time and try to display it before the job has been completed, Paperclip will be none the wiser and output the url of the image which is yet to be processed, which will result in a broken image link being displayed on the page.

To have the missing image url be outputted by paperclip while the image is being processed, all you need to do is add a #{attachment_name}_processing column to the specific model you want to enable this feature for. This feature gracefully degrades and will not affect models which do not have the column added to them.

  class AddAvatarProessingToUser < ActiveRecord::Migration
    def self.up
      add_column :users, :avatar_processing, :boolean
    def self.down
      remove_column :users, :avatar_processing
  @user = =>
  @user.avatar.url #=> "/images/original/missing.png"

  @user.avatar.url #=> "/system/images/3/original/IMG_2772.JPG?1267562148"

What if I’m not using images?

This library works no matter what kind of post-processing you are doing with Paperclip.

Does it work with s3?



Checkout out CONTRIBUTING for more info.

Something went wrong with that request. Please try again.