【问题标题】:Error reprocessing in Paperclip 2.3.5Paperclip 2.3.5 中的错误重新处理
【发布时间】:2010-10-29 19:21:51
【问题描述】:

我从 2.3.3 更新到 2.3.5 的字符串到数组的错误,现在当我尝试调用 Model.image.reprocess 时!我收到以下错误。这是我的代码中的东西还是回形针中的东西?或者在我上传的图片中?

"\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>'

相关型号:

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

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 amazon-s3 paperclip


    【解决方案1】:

    这是paperclip 的一个错误。恢复到以前的版本,你会没事的。这真的让我把头发拉了几天。 :)

    【讨论】:

    • 哼。它在主分支中固定吗?我可能只需要检查一下。如果我将 git repo 放入生产代码中,就不会出现任何问题,对吧? ;)
    • 看起来它实际上已在 3 天前修复,因此更新 gem 应该可以工作。它教会我如何指定一个 gem 版本,因为它在 heroku 上破坏了我的生产应用程序。 :)
    • 您使用的是什么版本的 gem?我在 2.3.5 上,它正在对我这样做。
    • 哦,这看起来像是一个新错误。 2.3.4 中引入了 to_file 字符串到数组的错误; 2.3.3 在 Rails 2.3 上对我来说工作正常。
    【解决方案2】:

    不是答案,只是确认我有同样的问题。 我在 Rails 3 上并尝试使用 Paperclip 2.3.5、2.3.4 和 2.3.3 在调用 reprocess 时,一切都无济于事,不断收到与 @Reactor5 相同的错误

    有什么想法吗?

    编辑 我对此进行了更多调查。 Paperclip 和 Ruby 1.9.2 似乎有问题 仍然不知道究竟是什么原因造成的,但切换到 Ruby 1.8.7 为我解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-15
      • 1970-01-01
      • 2011-12-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多