Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

Delayed Paperclip does not generate all styles in latest version of Paperclip #16

Closed
travisdahl opened this issue Feb 17, 2013 · 3 comments

Comments

@travisdahl
Copy link

I am experiencing this same issue. (I saw you were going to be maintaining from now on so I posted here)
jstorimer#67

When I include the line..

process_in_background :avatar 

Only the original gets saved to S3 and none of the other styles never make it.

My Model:

class Datenight < ActiveRecord::Base
  belongs_to :category

  has_attached_file :photo, 
    :styles => { 
        :full => "1136x1136",
        :medium => "300x300#", 
        :thumb => "100x100#"},
    :storage => :s3,
    :s3_credentials => "#{Rails.root}/config/s3.yml",
    :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
    :url => "/system/:attachment/:id/:style/:filename"

  process_in_background :photo

My Gemfile

source 'https://rubygems.org'
gem 'rails', '3.2.11'

gem 'sqlite3'
gem 'json'
gem 'aws-sdk', '~> 1.3.4'
gem "paperclip", "~> 3.3.0"
gem 'delayed_job_active_record'
gem 'delayed_paperclip', :git => 'git://github.com/jrgifford/delayed_paperclip.git'
...

I added the following in my migrations:

  create_table "datenights", :force => true do |t|
    ...
    t.boolean  "photo_processing"
  end


  create_table "delayed_jobs", :force => true do |t|
    t.integer  "priority",   :default => 0
    t.integer  "attempts",   :default => 0
    t.text     "handler"
    t.text     "last_error"
    t.datetime "run_at"
    t.datetime "locked_at"
    t.datetime "failed_at"
    t.string   "locked_by"
    t.string   "queue"
    t.datetime "created_at",                :null => false
    t.datetime "updated_at",                :null => false
  end

  add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"

I think Ive done everything right according to the wiki. Is there something Im missing? Is there some kind of job I need to set up?

There WAS one things in the wiki that wasnt too clear to me though (being a bit of a noob), In the part where it talks about adding the processing flag with a migration, in that same box it has:

@user = User.new(:avatar => File.new(...))
  @user.save
  @user.avatar.url #=> "/images/original/missing.png"
  Delayed::Worker.new.work_off

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

Im fairly certain that isnt part of the migration, but do I need to put this somewhere or is it just stating how it will work? Either way, I think the wiki "getting started" should be edited to make it more clear. It seems the "getting started" has just been copied with everyones forks and never updated. A details step by step would be great would be great for the inferior beings like myself ;p

Thanks for any future responses. I tried MANY solutions and NOTHING is working for me. Any help would be greatly appreciated

@travisdahl
Copy link
Author

Doh! I forgot this part of the delayed_job setup...

rails generate delayed_job:active_record
rake db:migrate

I have my delayed jobs running properly locally and on heroku now. Still having issues showing the missing or processing images though. That part of the wiki is unclear to me as stated in the last code block of my original post. Does that go in the controller create? A more thorough, step by step example would be great.

@jrgifford
Copy link
Owner

I can look into this sometime this week.

@travisdahl
Copy link
Author

Thanks for the reply @jrgifford . You can close this. Its all working for me now. It seems the block in question actually is not needed for the implementation at all. I guess it was more explanatory of what will happen when using delayed paperclip. I think the only change that would be useful here is to update the docs to make that a bit more clear. Referring to parts of code after the end in both Displaying images during processing and Custom image for processing

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants