delayed_paperclip icon indicating copy to clipboard operation
delayed_paperclip copied to clipboard

Delayed Paperclip does not generate all styles in latest version of Paperclip (v 3.0.4)

Open timols opened this issue 13 years ago • 4 comments

Currently, due to API changes in Paperclip from v3.0 onwards, the reprocess! method that is called from process_delayed! does not reprocess all of the styles since the post_processing instance attribute on the attachment is set to false after being created. When reassigned/saved this is not updated to true again.

This is easily overcome by updating the relevant method as follows:

  def process_delayed!
    self.job_is_processing = true
    self.post_processing = true
    reprocess!
    self.job_is_processing = false
  end

Happy to provide a pull request if appropriate.

timols avatar Jun 03 '12 03:06 timols

You sir, are very much appreciated

tarellel avatar Jun 17 '12 13:06 tarellel

Thanks mate, wrapped it in my recent commits to get S3 working:

https://github.com/aguilarsoto/delayed_paperclip/pull/2

So that now works for 2.7 -> 3.1.2 of paperclip and S3 uploads.

tommeier avatar Jul 02 '12 01:07 tommeier

Nice. Thanks for issuing the pull request.

timols avatar Jul 02 '12 01:07 timols

I am experiencing this same issue even with the following gems:

From Gemfile: gem 'delayed_paperclip', '2.4.5.2', :git => 'git://github.com/tommeier/delayed_paperclip', :branch => 'fix_312' gem 'paperclip', '~> 2.7.0'

From bundle show:

  • delayed_paperclip (2.4.5.2 c23a537)
  • paperclip (2.7.0)

My environment is

Rails 3.1.6 Ruby version: ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2011.03

Is it my Ruby verison? Too old perhaps?

My photo model contains: has_attached_file :file, :styles => STYLES, :default_style => DEFAULT_STYLE, :convert_options => { :new_square => '-auto-orient -thumbnail "x80" -resize "80x<" -resize 50% -gravity north -crop 40x40+0+0 +repage', :new_thumbnail => '-auto-orient -thumbnail "x120" -resize "120x<" -resize 50% -gravity north -crop 60x60+0+0 +repage', :new_small => '-auto-orient -thumbnail "x320" -resize "320x<" -resize 50% -gravity north -crop 160x160+0+0 +repage' }, :storage => USE_S3 ? :s3 : :filesystem, :s3_credentials => "#{::Rails.root.to_s}/config/amazon_s3.yml", :path => USE_S3 ? PATH_FORMAT : ":rails_root/public/paperclip/#{PATH_FORMAT}", :url => USE_S3 ? ":s3_alias_url" : "/paperclip/#{PATH_FORMAT}", :s3_host_alias => ::Rails.env =~ /^prod/ ? 'files.mobicious.com' : "files-#{::Rails.env}.mobicious.com", :s3_headers => {'Cache-Control' => 'max-age=315576000', 'Expires' => 10.years.from_now.httpdate}

Paperclip.interpolates :updated_at_timestamp do |attachment, style| Time.at(attachment.updated_at).strftime("%Y/%m/%d/%H%M%S") end

#process_in_background :file

Note that process_in_background is commented out to disable delayed_paperclip. (It works without it but the delays are unacceptable now)

Please advise.

Thanks, Dan

dsadaka avatar Oct 02 '12 05:10 dsadaka