使用CarrierWave上传导致"没有此类文件"错误

Dan*_*Dan 3 ruby-on-rails carrierwave

我刚刚开始玩CarrierWave并且无法让它表现得很好.

按照Rails Casts中的描述设置了所有内容后,我收到以下错误:No such file or directory - identify -quiet -ping /tmp/mini_magick20130519-13712-lxhans.jpg 注意:我知道Rails Cast中的拼写错误,并且我的代码中不存在该问题.

在我的开发环境中,我已经安装了libmagickwand-dev包,运行Rails 3.2.9,以及Ruby 1.9.3p194其他一些东西.我的Gemfile包括mini_magick.

传递给服务器的请求是这样的:

{"utf8"=>"?",
 "authenticity_token"=>"8ugcdkjOy/5yeodhuTgMXYdrXlcu2xPjxWTvvRwKnWM=",
 "organization"=>{"logo"=>#<ActionDispatch::Http::UploadedFile:0x0000000426c3d0 @original_filename="leather-tshirt-weird-square.jpg",
 @content_type="image/jpeg",
 @headers="Content-Disposition: form-data; name=\"organization[logo]\"; filename=\"leather-tshirt-weird-square.jpg\"\r\nContent-Type: image/jpeg\r\n",
 @tempfile=#<File:/tmp/RackMultipart20130519-13712-1uvmtem>>,
 "name"=>"Test Org",
 "description"=>"blah",
 "timezone"=>"1"},
 "commit"=>"Create Organization"}
Run Code Online (Sandbox Code Playgroud)

完整的跟踪位于:http://pastebin.com/dW5j9NLt

在最初尝试了一些更高级的功能之后,我将代码缩减为以下内容并且仍然没有运气:

class LogoUploader < CarrierWave::Uploader::Base

  include CarrierWave::MiniMagick

  storage :file

  version :thumb do
     process :resize_to_limit => [100, 100]
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end
end
Run Code Online (Sandbox Code Playgroud)

编辑:我已经将问题缩小到上传后修改图像的问题.如果我进一步简化代码以删除:thumb大小的创建,那么一切正常.思考?

UnS*_*per 6

没有足够的声誉评论thebrush的回答,但他绝对正确.在注意到我实际上一起缺少imagemagick之前,我遇到了同样的问题.

所以在Debian/Ubuntu上,这将是诀窍(或'magick'):

apt-get install imagemagick
Run Code Online (Sandbox Code Playgroud)

在使用yum作为数据包管理器(CentOS/RedHat)的操作系统上,您将使用:

yum install ImageMagick
Run Code Online (Sandbox Code Playgroud)