简体   繁体   English

回形针错误

[英]paperclip error

i am trying paperclip for the first time and followed this tutorial 我是第一次尝试回形针,并遵循了本教程

all is well until i use styles . 直到我使用样式,一切都很好。 this is the code 这是代码

has_attached_file :photo, :url => "/uploads/products/:id/:style/:basename.:extension",  
:path => ":rails_root/public/uploads/products/:id/:style/:basename.:extension",
:styles => { :thumb=> "100x100#" }

the error i see on the console is 我在控制台上看到的错误是

[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: C:/DOCUME~1/LOCALS~1/Temp/stream,2956,1.jpg is not recognized by the 'identify' command.>

what does this mean? 这是什么意思? I have no idea what it means. 我不知道这是什么意思。 Should i install this ImageMagick ? 我应该安装这个ImageMagick吗?

I tried installing it as a plugin as per this page . 我尝试按照此页面将其安装为插件。 This also returns an error that " plugin not found ". 这也会返回“ 找不到插件 ”的错误。

what am i missing here? 我在这里想念什么?

update: I am on windows xp. 更新:我在Windows XP上。 webrick server. webrick服务器。 I have rmagick gem 我有rmagick宝石

Run identify on your command prompt. 运行identify你的命令提示符。 If it identifies itself as ImageMagick, you have it installed. 如果将其标识为ImageMagick,则说明已安装。 Next, get a jpg that you know opens in a viewer and try identify <image>.jpg . 接下来,获取一个您知道在查看器中打开的jpg并尝试identify <image>.jpg If it shows the image properties, you can be sure you have ImageMagick working properly. 如果显示图像属性,则可以确保ImageMagick正常工作。 If not, depending on your OS, install IM again. 如果不是,则根据您的操作系统,再次安装IM。

Sometimes, you might have to remove the preinstalled libjpeg and libpng libraries that come installed with your OS, for IM to install properly. 有时,您可能必须删除操作系统随附的预安装的libjpeg和libpng库,以使IM正确安装。 Since you are on windows, you need not worry about this. 由于您在Windows上,因此无需担心。 Just follow the installation for windows from here: http://www.imagemagick.org/script/install-source.php and be sure to set the paths right. 只需从以下位置进行Windows安装即可: http : //www.imagemagick.org/script/install-source.php并确保正确设置路径。

in the source of paperclip.rb , if you change the line option.split("'").map{|m| 在paperclip.rb的源代码中,如果您更改行option.split(“'”)。map {| m | "'#{m}'" }.join("\\'") to the following: option.split("'").map{|m| “'#{m}'”} .join(“ \\'”)到以下内容:option.split(“'”)。map {| m | "\\"#{m}\\"" }.join("\\'") “ \\”#{m} \\“”} .join(“ \\'”)

it works Here is the complete changed method: 它的工作原理这是完整的更改方法:

def quote_command_options(*options)
  options.map do |option|
    option.split("'").map{|m| "\"#{m}\"" }.join("\\'")
  end
end

If you just installed imagemagick and you're on windows, it may help to do a "full reboot". 如果您刚安装imagemagick并且在Windows上,则可能有助于“完全重新启动”。 I assume something wasn't stopping properly, and wasn't picking up the new path. 我认为有些事情没有正常停止,也没有选择新的道路。

(probably just closing everything will work, but I just went for a full reboot to be sure) (可能只是关闭所有内容即可,但可以确定的是我要进行完全重新启动)

it means "identify" failed to tell what kind of file you uploaded, that might be caused by a bad file upload but also by a missing ImageMagick. 这意味着“识别”未能告诉您您上传的文件类型,这可能是由于文件上传错误而导致的,也可能是由于缺少ImageMagick。 I dont know how that is usually handled on windows. 我不知道通常在Windows上如何处理。

You need install the ImageMagick 您需要安装ImageMagick

Ubuntu: Ubuntu的:

sudo apt-get install imagemagick

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

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