简体   繁体   English

Paperclip 2.3.5中的错误重新处理

[英]Error reprocessing in Paperclip 2.3.5

I updated from 2.3.3 to 2.3.5 for the string to array bug, and now when I try to call Model.image.reprocess! 我将字符串数组错误从2.3.3更新到2.3.5,现在当我尝试调用Model.image.reprocess时! I get the following error. 我收到以下错误。 Is this something in my code or something in paperclip? 这在我的代码中还是在回形针中? Or maybe in the image I'm uploading? 还是在我上传的图片中?

"\xFF" from ASCII-8BIT to UTF-8
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/paperclip-2.3.5/lib/paperclip/storage/s3.rb:134:in `to_file'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/paperclip-2.3.5/lib/paperclip/attachment.rb:219:in `reprocess!'
/home/brian/Dropbox/portfolio/app/models/asset.rb:34:in `regenerate_styles!'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/performable_method.rb:20:in `perform'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/backend/base.rb:77:in `invoke_job'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:118:in `block (2 levels) in run'
/home/brian/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:118:in `block in run'
/home/brian/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:117:in `run'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:176:in `reserve_and_run_one_job'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:102:in `block in work_off'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:101:in `times'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:101:in `work_off'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:76:in `block (2 levels) in start'
/home/brian/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:75:in `block in start'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:72:in `loop'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:72:in `start'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:100:in `run'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:79:in `block in run_process'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:250:in `call'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:250:in `block in start_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/daemonize.rb:199:in `call'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/daemonize.rb:199:in `call_as_daemon'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:254:in `start_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:294:in `start'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/controller.rb:70:in `run'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons.rb:193:in `block in run_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `call'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `catch_exceptions'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons.rb:192:in `run_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:78:in `run_process'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:72:in `block in daemonize'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:70:in `times'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:70:in `daemonize'
script/delayed_job:5:in `<main>'

Relevant model: 相关型号:

class Asset < ActiveRecord::Base
  attr_accessible :image, :image_file_name, :image_content_type, :image_file_size, :portfolio_item_id, :order

  belongs_to :portfolio_item

  has_attached_file :image,
    :styles => {
      :thumb => "20x20#",
      :small => "100x100",
      :large => "600x600>"
               },
    :storage => :s3,
    :s3_credentials => {
      :access_key_id => ENV["S3_KEY"],
      :secret_access_key => ENV["S3_SECRET"]
                       },
    :bucket => ENV["S3_BUCKET"],
    :path => "portfolio/:attachment/:id/:style/:basename.:extension"

  before_image_post_process do |image|
    if changed?
      processing = true
      false
    end
  end

  after_save do |image|
    if image.changed?
      send_later(:regenerate_styles!)
    end
  end

  def regenerate_styles!
    self.image.reprocess!
    self.processing = false
    self.save(false)
  end

  def changed?
    self.image_file_size_changed? ||
    self.image_file_name_changed? ||
    self.image_content_type_changed? ||
    self.image_update_at_changed?
  end
end

It's a bug with paperclip . 回形针是一个错误。 Revert to the previous version and you'll be fine. 恢复到以前的版本,您就可以了。 This really had me pulling my hair out for a few days as well. 这确实让我也拉了几天头发。 :) :)

Not an answer, just confirming I have the same issue. 没有答案,只是确认我有同样的问题。 I'm on Rails 3 and have tried using Paperclip 2.3.5, 2.3.4 and 2.3.3 All to no avail keep getting the same error as @Reactor5 when invoking reprocess 我在Rails 3上并尝试使用Paperclip 2.3.5、2.3.4和2.3.3都无济于事,在调用reprocess时,与@ Reactor5保持相同的错误

Any ideas? 有任何想法吗?

EDIT I looked into this some more. 编辑我研究了这一点。 It seems to be an issue with Paperclip and Ruby 1.9.2 Still don't know exactly what causes it, but switching to Ruby 1.8.7 solved the issue for me. Paperclip和Ruby 1.9.2似乎是一个问题,但仍然不知道是什么原因导致的,但是切换到Ruby 1.8.7可以为我解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM