Giter Club home page Giter Club logo

delayed_paperclip's People

Contributors

aguilarsoto avatar bertg avatar bigfleet avatar csaura avatar dtaniwaki avatar equivalent avatar etagwerker avatar jimryan avatar joshk avatar jrgifford avatar jstorimer avatar katafrakt avatar kevinmtrowbridge avatar leighhalliday avatar maintux avatar maxim avatar morgoth avatar mrnugget avatar neilco avatar nuckchorris avatar omnikron avatar patrickbajao avatar rezaolfat avatar riffraff avatar sbkok avatar scotterc avatar timbo avatar tommeier avatar tonkpils avatar vdaubry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

delayed_paperclip's Issues

Help testing against edge resque

Hey there!

I'm gearing up to work on Resque 2.0, and I'd like to coordinate better with plugin authors to make sure stuff doesn't break.

I'd like to know a few things:

  1. Can I do something to help get you testing against edge Resque?
  2. Are you monkey-patching anything in Resque currently? Can 2.0 expose an API to help you not have to do that any more?
  3. Do you need any help in bringing your plugin up-to-date with the latest Resque?

Thanks!

Related: resque/resque#880

Rails 2

Hi guys, I'm trying to use this gem (version 2.4.5.2) with rails 2.3.18, paperclip 2.7.5 and delayed_job 2.0.8, but I have back this error:

ArgumentError (Cannot enqueue items which do not respond to perform):
  /home/maintux/.rvm/gems/ree-1.8.7-2012.02/gems/delayed_job-2.0.8/lib/delayed/backend/base.rb:13:in `enqueue'
  /home/maintux/.rvm/gems/ree-1.8.7-2012.02/gems/delayed_paperclip-2.4.5.2/lib/delayed_paperclip/jobs/delayed_job.rb:10:in `enqueue_delayed_paperclip'
  /home/maintux/.rvm/gems/ree-1.8.7-2012.02/gems/delayed_paperclip-2.4.5.2/lib/delayed_paperclip.rb:27:in `enqueue'
  /home/maintux/.rvm/gems/ree-1.8.7-2012.02/gems/delayed_paperclip-2.4.5.2/lib/delayed_paperclip.rb:89:in `enqueue_post_processing_for'
  /home/maintux/.rvm/gems/ree-1.8.7-2012.02/gems/delayed_paperclip-2.4.5.2/lib/delayed_paperclip.rb:82:in `enqueue_delayed_processing'
  /home/maintux/.rvm/gems/ree-1.8.7-2012.02/gems/delayed_paperclip-2.4.5.2/lib/delayed_paperclip.rb:81:in `each'
  /home/maintux/.rvm/gems/ree-1.8.7-2012.02/gems/delayed_paperclip-2.4.5.2/lib/delayed_paperclip.rb:81:in `enqueue_delayed_processing'

Anyone can help me?
Thanks!

getting exception while uploadign photos

Hi i am getting attachment_definitions exception while genrating styles using background process. I am using rails 3.1.12 with sidekiq worker

Can any one suggest me what i did wrong

Displaying original image while processing as an option to :processing_image_url

The idea of displaying the original image while processing thumbs etc. seems to be floating around. However it is not available as an option in delayed_paperclip.
Is there any reason why you haven't done it already?
I am thinking about contributing to delayed_paperclip and submitting a patch request with it, but I would like to know if it was considered before or maybe rejected for some reason?

My idea was to make :processing_image_url accept a symbol of a method name in the model, that would be called to calculate the path to the original image. Or another option would be to allow :original symbol as on option for :processing_image_url.
I do struggle however to find the path of the original image in the paperclip attachment.

It can obviously be done in the view by checking .processing? and then displaying url(:thumb) or url(:original), but I treat it as a last resort

I would appreciate any suggestions or hints.

undefined method `[]' for nil:NilClass

Hi,

I have a Rails 4 app which is using paperclip.

I add the following to gem file: gem 'delayed_paperclip'

Followed by:

has_attached_file :photo, :s3_protocol => :https, :styles => { :medium => "250x250", :thumb => "70x70" }, :default_url => "/images/not_found/not_found.jpg", :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml"
validates_attachment :photo, content_type: { content_type: /^image/(png|jpeg)/ }

process_in_background :photo

I start sidekiq with: sidekiq -q paperclip

I try to upload a photo and I get the subject error.

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

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

Get Travis testing on ruby 2.0

right now, delayed_paperclip doesn't work on ruby 2.0. We should fix that.

[jrg@atlantis|delayed_paperclip (master)]$ rake
>> bundle check --gemfile='/home/jrg/tmp/delayed_paperclip/gemfiles/rails3.gemfile' || bundle install --gemfile='/home/jrg/tmp/delayed_paperclip/gemfiles/rails3.gemfile'
Resolving dependencies...
The Gemfile's dependencies are satisfied
>> bundle check --gemfile='/home/jrg/tmp/delayed_paperclip/gemfiles/rails3_1.gemfile' || bundle install --gemfile='/home/jrg/tmp/delayed_paperclip/gemfiles/rails3_1.gemfile'
Resolving dependencies...
The Gemfile's dependencies are satisfied
>> bundle check --gemfile='/home/jrg/tmp/delayed_paperclip/gemfiles/rails3_2.gemfile' || bundle install --gemfile='/home/jrg/tmp/delayed_paperclip/gemfiles/rails3_2.gemfile'
Resolving dependencies...
The Gemfile's dependencies are satisfied
>> BUNDLE_GEMFILE=/home/jrg/tmp/delayed_paperclip/gemfiles/rails3.gemfile bundle exec /home/jrg/.rbenv/versions/2.0.0-p195/bin/rake test
/home/jrg/.rbenv/versions/2.0.0-p195/bin/ruby -I"lib:lib:test" -I"/home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib" "/home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" 
/home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration/mini_test.rb:56:in `<class:TestCase>': No Mocha monkey-patch for MiniTest version (RuntimeError)
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration/mini_test.rb:20:in `<class:Unit>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration/mini_test.rb:19:in `<module:MiniTest>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration/mini_test.rb:18:in `<top (required)>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration.rb:45:in `require'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration.rb:45:in `block in <top (required)>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration.rb:44:in `each'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha/integration.rb:44:in `<top (required)>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha.rb:2:in `require'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/mocha-0.12.6/lib/mocha.rb:2:in `<top (required)>'
    from /home/jrg/tmp/delayed_paperclip/test/test_helper.rb:3:in `require'
    from /home/jrg/tmp/delayed_paperclip/test/test_helper.rb:3:in `<top (required)>'
    from /home/jrg/tmp/delayed_paperclip/test/resque_paperclip_test.rb:1:in `require'
    from /home/jrg/tmp/delayed_paperclip/test/resque_paperclip_test.rb:1:in `<top (required)>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `require'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
    from /home/jrg/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [/home/jrg/.rbenv/versions/2.0.0-p195/bin/r...]

Tasks: TOP => test
(See full trace by running task with --trace)
[jrg@atlantis|delayed_paperclip (master)]$ 

Problems with multiple process_in_background calls

I get the following error when I have more than one process_in_background call.

NoMethodError - undefined method `[]=' for nil:NilClass: () Users/dan/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/delayed_paperclip-d6cbb7b41dea/lib/delayed_paperclip.rb:51:in `process_in_background'

In the code below, it doesn't matter which has_attached_file attachment I call it on. If there are two, it fails.

has_attached_file :photo, {
  styles: {
    thumb:  ['100x100#', :jpg],
    medium: ['300x300#', :jpg],
  }
}.merge(PAPERCLIP_STORAGE_OPTIONS)
process_in_background :photo

has_attached_file :picture, {
  styles: {
    thumb:  ['100x100#', :jpg],
    medium: ['300x300#', :jpg],
  }
}.merge(PAPERCLIP_STORAGE_OPTIONS)
process_in_background :picture

Error

Everything worked fine until I added:

process_in_background :avatar - to my model.

I'm using S3 to store the images and I am using cropping as suggested by Ryan Bates in Railcasts Episode 182. After adding delayed_paperclip I am getting an error. It is weirdly pointing to this method:

def avatar_geometry(style = :original)
@geometry ||= {}
avatar_path = (avatar.options[:storage] == :s3) ? avatar.url(style) : avatar.path(style)
@geometry[style] ||= Paperclip::Geometry.from_file(avatar_path)
end

But the method works fine when I comment out process_in_background :avatar and I am able to crop and reprocess. It's just that it wont delay the job and takes 8-12 seconds. Is it throwing an error because the avatar_path should be different when using delayed_paperclip?

Publish latest changes to ruby gems

Any changes of getting rubygems updated with latest changes? I'm specifically interested in seeing reprocess_without_delay! as part of the published version.
Thanks!

NoMethodError: undefined method `[]=' for nil:NilClass with multiple attachments

Hi,

I don't know whether it can be fixed or just something that should be mentioned somewhere in the docs, but if you have 2 attachments on the same model, the following will cause "NoMethodError: undefined method []=' for nil:NilClass in delayed_paperclip-2.7.1/lib/delayed_paperclip.rb:51:inprocess_in_background'":

has_attached_file :first
process_in_background :first
has_attached_file :second
process_in_background :second

while this will work

has_attached_file :first
has_attached_file :second
process_in_background :first
process_in_background :second

Best,

Version 2.6.0.0 does not process non-delayed style

Hello,

Since upgrading to the last version, it seems that all the style that are not delayed are not processed anymore, here is my setup :

 process_in_background :img, :only_process => [:large,:edit,:feed,:email,:comment_email,:thumb,:small]

I have all these styles and I have a medium style that I want to process imediatly so I left it out the process_in_background options.
Since I updated my gem the medium style is not processed anymore by paperclip, if I add it to the process_in_background it's process in delay but if I don't include it this style is never processed.

I reverted to 2.5.1.0 and everything is working again as expected,

Thank you,

fog_public always defaults to true in delayed_job background

There appears to be an issue where the fog_public option is not maintained in the delayed background. I'm overriding the fog_public method and it's just hitting the 'true' response each time.

module Paperclip
  module Storage
    module Fog
      def fog_public(style = default_style)
        if @options.has_key?(:fog_public)
          if @options[:fog_public].respond_to?(:has_key?) && @options[:fog_public].has_key?(style)
            @options[:fog_public][style]
          else
            @options[:fog_public]
          end
        else
          # Always hits here with a delayed_job instance. It's not calling the attachment instance?
          true
        end
      end
   end
end

Delayed processing strips complicated styles

I have some complicated styles which have specific convert options like the one below.

:styles => { :fw_small => { geometry: '320x', convert_options: "-quality 50 -strip" } }

These work fine without background processing but are lost when processed in the background.

Possible to do a 2.7.2 release?

Hey guys,

Is it possible to publish the current master (2cbc1dd) as a 2.7.2 release? The delayed_paperclip_defaults from #88 is very useful for us and it would be great to include the gem from RubyGems instead of direct from Github.

Thanks!

"Missing" image gets deleted when the delayed conversion runs

I had a really odd thing happen in development as I was trialing this gem. I started with the usual :default_url => "/images/:style/missing.png" set in Paperclip, but I had not yet added the :processing_image_url => "/images/original/processing.jpg" definition. When I uploaded an image, it initially showed the "missing" image, but when DJ ran the conversion process, the missing image was interpreted as being the actual file attached to the record, and so when Paperclip added the converted versions, it removed the missing image (deleted it from disk!) and replaced it with the newly-converted image. This happened a couple of times before I figured out what was going on.

delayed_paperclip not pushing jobs to sidekiq in test environment

delayed_paperclip works as expected in the dev environment, but my feature specs fail because the image does not exist.

My spec passes only if I remove process_in_background :file from my model

Error

I get the following error:

  1) Attachments can upload attachments to invoices
     Failure/Error: Unable to find matching line from backtrace
     ActionController::RoutingError:
       No route matches [GET] "/system/attachments/5627e3964f2ae3f66840ec15/thumb/avatar.jpg"

Sidekiq console log

I can see in my sidekiq console window, that jobs are not entering the queue.

$ bundle exec sidekiq -e test -q paperclip -q default -c 10 -v
2013-11-12T10:11:27Z 43891 TID-ovfl3uwgs INFO: Booting Sidekiq 2.16.1 with redis options {:url=>nil, :namespace=>"myapp"}
2013-11-12T10:11:27Z 43891 TID-ovfl3uwgs INFO: Running in ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
2013-11-12T10:11:27Z 43891 TID-ovfl3uwgs INFO: See LICENSE and the LGPL-3.0 for licensing details.
2013-11-12T10:11:27Z 43891 TID-ovfl3uwgs INFO: Starting processing, hit Ctrl-C to stop
2013-11-12T10:11:27Z 43891 TID-ovfm2ludw DEBUG: {:queues=>["paperclip", "default"], :concurrency=>10, :require=>".", :environment=>"test", :timeout=>8, :profile=>false, :strict=>true, :verbose=>true, :tag=>"myapp"}

There's no more output after that

Notes

  1. I do have a file_processing column in my test database. Migration also run.
  2. sidekiq is running in test environment too.
  3. I have required 'rspec/rails' in my spec_helper.rb and have the hooks in the config as per the Sidekiq wiki page on testing.
  4. I am using the rspec-sidekiq gem in my test environment.

Am I missing something else? Thanks!

Regenerate a cache after processing of an image

I couldn't find a good way to regenerate a cache when an image as been process.

What I wanted to do seems quite simple, I wanted to show the original image while it is being process in the background.

But the problem is that when the image is resized, the original keep showing up in the cache.

I wrote this hack to do it, but it's really ugly, I am sure we can find a better way to do it.

Basic Resque Example?

I've got Resque running with a worker running, which I know is working as its also processing some Solr stuff in the background.

In my document model I have the following:

  has_attached_file :upload, 
                :styles => { :preview => ["725x1200>", :jpg], :thumb => ["200x280>", :jpg] },
                :processors => [:ghostscript, :thumbnail],
                :convert_options => { :all => '-colorspace RGB -flatten -density 300 -quality 100' }

  process_in_background :upload

Yet, in the console it would appear that all of the image process stuff is happening on my web unicorn worker, not my resque_worker. Below is my Procfile.

web: bundle exec unicorn -c lib/unicorn/config.rb -p $PORT
resque_worker: env QUEUE=* bundle exec rake environment resque:work

I'm sure I'm missing something terribly basic here, but what am I doing wrong?

Saving photos which are processing in background.

Hi,

I'm using this gem and I'm so happy with things it can do. But I got an issue now. Due to requirement, I have to allow user to change their photos information (just meta information not attachment) no matter it is processing or not. After turning a photo to processing mode, saving this photo will causes its process running on main thread, not in background. I had no idea and tried to read your code but no clue. I guess that there is some magic in after_commit and after_save callbacks but I don't know where it exactly is.

Non-Delayed Paperclip attachment file_name, etc. not being removed instantly.

I had implemented delayed_paperclip for a model that had a large attachment with a custom processor and it worked great.

For some reason, however, I am getting odd behavior from other models paperclip attachments that are not delayed. (I am not using process_in_background anywhere in the model definition )

The attachments are uploading fine and without any kind of handoff to delayed job. When I try to destroy an attachment, the behavior changes. The attachment deletes, and is even removed from S3, but it seems that the attachment_file_name and reference to the attachment are not cleared.

After the attachment is destroyed (which returns true), I save my model (also returns true) and then redirect to my show view. The view is responding as if the attachment still exists, but now with a broken link since the actual file has been removed. If I refresh a few seconds later, the view behaves properly.

In console here is my result

model.attachment.destroy => true
model.attachment => "/images/original/missing.png"
model.save => true
model.attachment => "http://s3.amazonaws.com/mys3bucketname/attachments/159012/original/OriginalFileName.psd?1398985932"

When I removed the delayed_paperclip gem this worked as expected properly destroying the attachment. What is happening here?

Thanks for your time, it is an awesome gem. I just need to resolve this issue.

How to have one style available immediately?

I have a question when uploading and requiring at least one of the styles to be available immediately.

Let's say the user uploads a large picture using some kind of ajax experience. I have 4 styles but on the ajax experience I only want to show one of those styles. What is the best way to get one of those four styles available immediately, but the rest in the background via delayed_paperclip.

I tried using only_process but doesn't look like it is working for me. Perhaps I am using it wrong. Any help would be appreciated.

PS This gem is a life saver. Thank you for creating it.

Allow RBX failures

Allow rbx to fail, since we can't seem to consistently get it to pass (or work on our local machines for that matter).

How to setup to display processing message during image processing

I tried the Displaying images during processing of README but it doesn't work well.
I'm curious about the difference between the default_url option of has_attached_file and the code of "Displaying images during processing" of README.

Is anybody who can explain the step-by-step procedure?

AWS::S3::Errors::NoSuchKey No Such Key EXCEPT

Using with s3 I observe attempts to get a thumbnail before processing.

[paperclip] copying ..._original.jpeg to local file ...
[AWS S3 200] get_object(:bucket_name=>"...",:key=>"..._original.jpeg")
[AWS S3 200] head_object(:bucket_name=>"...",:key=>"..._original.jpeg")
[AWS S3 404] head_object(:bucket_name=>"...",:key=>"..._thumb.jpeg") AWS::S3::Errors::NoSuchKey No Such Key EXCEPT

My setup:
aws-sdk (1.6.9)
paperclip (3.3.0)
delayed_paperclip (2.5.0.1)

Any ideas?

Sidekiq raising record_not_found for Image with given 'id'

I'm using v2.80 with Sidekiq, and consistently get a message like the following:

WARN: {"retry"=>true, "queue"=>"paperclip", "class"=>"DelayedPaperclip::Jobs::Sidekiq", "args"=>["Image", 335, "asset
"], "jid"=>"c69e1f07d9d7169a51cece3b", "enqueued_at"=>1404271266.1547618, "error_message"=>"Couldn't find Image with 'id'=335", "error_class"=>"ActiveRec
ord::RecordNotFound", "failed_at"=>1404271357.9601784, "retry_count"=>4, "retried_at"=>1404314984.4634533}"

I confirmed that an Image with id = 335 definitely exists, so it seems as though there may be some sort of race condition with Sidekiq picking up the job before the record has been saved. Has anyone else encountered this issue?

Figure out why the tests for rails2 fail locally and run fine on travis

So for some reason, the tests fail locally with this:

>> bundle install --gemfile=/home/jrg/code/delayed_paperclip/gemfiles/rails2.gemfile
Fetching gem metadata from http://rubygems.org/........
Bundler could not find compatible versions for gem "delayed_job":
  In Gemfile:
    delayed_job_active_record (>= 0) ruby depends on
      delayed_job (= 3.0.0.pre) ruby

    delayed_job (2.0.7)

I think the answer is that we need to remove the gemfile.lock, but I'm not sure, since I can replicate it without a gemfile.lock

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Error while saving image using delayed_paperclip

Hi,
I am getting the following error while uploading a photo using delayed_paperclip and sidekiq gems.
ERROR: undefined method `enqueue_delayed_paperclip' for nil:NilClass

Here is my code follows

resource.rb

has_attached_file :image , :default_url => "/assets/member.png",
    :storage => :s3,
    :bucket => ENV['AMAZON_BUCKET_NAME'],
    :s3_credentials => {
    :access_key_id => ENV['AMAZON_API_KEY'],
    :secret_access_key => ENV['AMAZON_API_SECRET']
  },
    :s3_protocol => "https",
    :styles => {
    :big => "498X300>",
    :profile => "498X300>",
    :large => "300x300>",
    :thumb => "148x121>",
    :gallery => "130x112>",
    :medium => "70X72>",
    :tiny => "67X55>",
    :small =>"21X21>"
  }
  validates_format_of :image_file_name, :with => %r{\.(png|gif|jpg|jpeg|bmp)$}i
  validates_attachment_content_type :image, :content_type =>  ['image/gif','image/jpeg','image/png','image/bmp'] ,:message => 'must be gif,jpeg,png,bmp'
  validates_attachment_size :image, :less_than => 10.megabytes
  process_in_background :image, :only_process => [:profile,:large,:thumb,:gallery,:medium,:small,:tiny]

In my gem file i am using

gem 'delayed_paperclip'
gem 'sidekiq', '3.0.0'

Paperclip still tries to display image even if object_processing exists in Database

Here is my config for PaperClip:

has_attached_file :avatar, PAPERCLIP_OPTIONS.merge(
    :default_url => "//s3.amazonaws.com/production-recruittalk/media/avatar-placeholder.gif",
    :styles => {
      :"58x58"   => "35x35^",
      :"150x150" => "56x56^",
      :"184x185" => "165x110^",
      :"259x259" => "259x259^"
    },
    :convert_options => {
      :"58x58"   => "-background transparent -auto-orient -gravity center -extent 58x58",
      :"150x150" => "-background transparent -auto-orient -gravity center -extent 150x150",
      :"184x185" => "-background transparent -auto-orient -gravity center -extent 184x185",
      :"259x259" => "-background transparent -auto-orient -gravity center -extent 259x259"
    }
  )

  process_in_background :avatar, 
    processing_image_url: "/images/avatar-placeholder.gif", 
    only_process: [:"58x58", :"150x150", :"184x185", :"259x259"]

In the view:

<%= image_tag(@athlete.avatar.url("259x259")) %>

Even if I use just <%= image_tag(@athlete.avatar.url) %>, a broken image is displayed... any reason why this isn't working?

object_processing column set to false as soon as Sidekiq job begins processing

I'm using delayed_paperclip with Sidekiq. Everything works great, aside from toggling :processing_image_url ON/OFF. As a result, when an image is still being processed in the background, a bad image link is served on the page.

If Sidekiq is not running and the jobs are queued, the :processing_image_url is served, but as soon as the job is started, the (bad) link that has not been processed yet is served.

It seems like on my Image model, the photo_processing column should be set to false after the sidekiq process finishes, not when it starts.

My setup is here: https://gist.github.com/pzaich/6157498

NoMethodError: undefined method `[]' for nil:NilClass

Paperclip (3.5.1) works just fine.

When adding the gem to my gemfile:

gem "delayed_paperclip", :git => "git://github.com/jrgifford/delayed_paperclip.git"

Restarting the console:

User.last.avatar.url

NoMethodError: undefined method []' for nil:NilClass from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/bundler/gems/delayed_paperclip-a13b4cba98ed/lib/delayed_paperclip/attachment.rb:16:indelayed_options'
from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/bundler/gems/delayed_paperclip-a13b4cba98ed/lib/delayed_paperclip/url_generator.rb:33:in delayed_default_url?' from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/bundler/gems/delayed_paperclip-a13b4cba98ed/lib/delayed_paperclip/url_generator.rb:11:inmost_appropriate_url_with_processed'
from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/bundler/gems/paperclip-1d8982325fb4/lib/paperclip/url_generator.rb:13:in for' from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/bundler/gems/paperclip-1d8982325fb4/lib/paperclip/attachment.rb:149:inurl'
from (irb):12
from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in start' from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/commands/console.rb:8:instart'
from /Users/Laurens/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/commands.rb:41:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Option to use another id column

Hey i was wondering if there was anyway that we could add the ability to use a specified column as the id. Currently it used the 'id' column but in my app the primary key is a column named 'unique_id'. This gem works great, but this minor issue if causing some problems. If you would like i could possibly implement this and submit a request.

Delayed_paperclip not working, throwing weird errors

I am trying to offload a huge file upload to another process, and from the description, delayed_paperclip was the gem to use. I use paperclip flawlessly with aws-s3 but trying to push it to another process, it just fails.

When I try to access my /media page, it alternates between these two errors:

Started GET "/media" for 127.0.0.1 at 2012-10-08 08:35:13 -0500

NoMethodError (undefined method `key?' for nil:NilClass):

or...

Started GET "/media" for 127.0.0.1 at 2012-10-08 08:35:07 -0500

ActionController::RoutingError (undefined method []' for nil:NilClass): app/models/medium.rb:7:inclass:Medium'

I posted what I think is relevant in this gist:

https://gist.github.com/3852580

Any help would be appreciated...

Thanks!

Calling #reprocess!

Two issues that I'm trying to narrow down.

Calling reprocess! on an attachment does delay the processing however it ignores arguments to the method such as reprocess!(:thumbnail) which should only reprocess that thumbnail, instead it reprocesses all of them. Paperclip without delayed_paperclip works correctly here.

Calling reprocess! for an attachment that is supposed to be converted to another file type such as style: { thumbnail: ['100x100', :jpg] } will not happen and will keep the same file type which leads to file not found errors because paperclip urls will believe the file exists. However, normal processing through delayed_paperclip will change the format.

Edit:
Looks like paperclip is doing it's normal job on reprocess! and then calling save which invokes all of delayed_paperclip functionality specifically the results above.

Right now I'm trying to figure out how to know if #reprocess! is called so we don't prepare enqueueing here.

Add simple queue support for delayed_job

I would like to suggest the inclusion of queuing semantics into jobs/delayed_job.rb for those who use the latest versions of DJ. Happy to send a very simple pull request if you would be interested.

This enables me (and anyone else who would benefit) to distinctly manage delayed paperclip tasks without needing to ensure all other tasks are kept off the main queue.

Thanks
k.

only_process not working

My model :

  has_attached_file :image,
    :storage => :s3,
    :bucket => ENV['AMAZON_BUCKET_NAME'],
    :s3_credentials => {
    :access_key_id => ENV['AMAZON_API_KEY'],
    :secret_access_key => ENV['AMAZON_API_SECRET']
  },
    :s3_protocol => "https",
    :styles => {
    :large => "300x300!",
    :thumb => "148x121!",
    :gallery => "130x112!",
    :medium => "70X72!",
    :tiny => "67X55!",
    :small =>"21X21!"
  }

  process_in_background :image, :only_process => [:thumb,:medium,:tiny,:small]

I am using this gem with sidekiq, it working fine but when I use only_process it regenerate original image also. I want to show Image after save immediately .

My requirement is reprocess (background job apply for only ) [:medium,:tiny,:small] styles, except these styles create directly and not reprocess .

Thanks in Advance,
Prasad.

Upload still being processed immediately

In my development enivornment, uploads are still blocking and aren't being handled asynchronously. I've got redis and sidekiq started in development.

My stack:

delayed_paperclip (2.7.1)
paperclip (4.1.1)
sidekiq (3.1.0)

My model:

include Sidekiq::Worker
...
has_attached_file :photo
process_in_background :photo, processing_image_url: "path/to/img.png"

Log tailing shows processing happening synchronously:

[paperclip] saving /my-cool-photos/62/original/my_image.jpg
[AWS S3 200 6.778036 0 retries] put_object(:acl=>:public_read,:bucket_name=>"awesome_bucket",
                            :content_length=>267949,:content_type=>"image/jpeg",
                            :data=>Paperclip::UploadedFileAdapter: my_image.jpg,
                            :key=>"my-cool-photos/62/original/my_image.jpg")  

(0.8ms)  COMMIT
SQL (0.8ms)  UPDATE "people" SET photo_processing = 't' WHERE "people"."id" = 62
Redirected to http://mywebsite.dev/people/62
Completed 302 Found in 7021ms (ActiveRecord: 13.1ms)
Review Load (0.6ms)  SELECT "people".* FROM "people" WHERE "people"."id" = $1 LIMIT 1  [["id", 62]]
[paperclip] copying /my-cool-photos/62/original/my_image.jpg to 
        local file /var/folders/14/03xx7l1s2plg2r4_8zhzttjw0000gn/T/974f4cf28e66e597e205812d72a50e9520120531-27884-zairtv

In fact, when I kill my sidekiq process, the photo still uploads (I can see it in my S3 bucket) but photo_processing is set to true. Once sidekiq runs the job, the value just gets set to false.

expiring_url does not work with "Displaying images during processing"

Hi

I'm using Delayed_Paperclip with S3 and using the following function to display my images: http://rubydoc.info/github/thoughtbot/paperclip/Paperclip/Storage/S3:expiring_url

The problem is that it does not work according to your section "Displaying images during processing".

Here's my current workaround:

<%= image_tag image_link.image.expiring_url(3600, image_link.image.processing? ? :original : :square) %>

It would be better delayed_paperclip could override this function to return the proper default_image

reprocess_without_delay! does not mark the image as processed

I would expect that calling reprocess_without_delay! on an attachment would mark the image as processed, but this is currently not the case.

p = Photo.create image: file
p.image_processing?
  => true
p.reprocess_without_delay!
p.image_processing?
  => true
p.image.url(:square)
  => /images/square/missing.png

How to display the original file even if the file still in processing

class Stream::Audio < Asset
  has_attached_file :attachment,
    styles: { waveform: { format: :png, convert_options: { color: :transparent, background_color: "#eeeeee"}}},
  processors: [ :waveform ]
  process_in_background :attachment, :processing_image_url => "/missing/processing.png"
end

For example I am using paperclip_waveform to generate waveform image. I just want to display the missing waveform url something like:

@stream.audio.url(:waveform) "/missing/processing.png"

but keep the original url

@steam.audio.url(:original) "audio.wav"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.