Resize Error - Paperclip::Errors::NotIdentifiedByImageMagickError

吃可爱长大的小学妹 提交于 2019-12-04 19:54:43

To answer Rich Peck's question, you don't have to add it into the model directly - you can add it into /config/environments/development.rb. That way it'll only affect your dev version and not your production version.

So in my case, I just added

Paperclip.options[:command_path] = 'C:\Program Files\ImageMagick-6.8.7-Q16'

to the end of my config/environments/development.rb file and it worked like a charm.

Had the exact same issue with the same omrails assignment - rebooting my machine fixed my issue.

You probably haven't installed imagemagick and haven't pointed to it in your application.

As stated in the documentation:

ImageMagick must be installed and Paperclip must have access to it. To ensure that it does, on your command line, run which convert (one of the ImageMagick utilities). This will give you the path where that utility is installed. For example, it might return /usr/local/bin/convert.

In development mode, you might add this line to config/environments/development.rb):

Paperclip.options[:command_path] = "/usr/local/bin/"

I had this problem, and fixed it by including Paperclip.options[:command_path] = "YOUR_PATH_TO_IMAGE_MAGICK" in the upload model (in my case image.rb):

(Windows 7, Rails 4 & Ruby 2.0):

#Image Upload 
has_attached_file :image,
    :command_path => 'C:\RailsInstaller\ImageMagick',
    :styles => { :medium => "x300", :thumb => "x100" },
    :default_url => "xxxxx",
    :storage => :s3,
    :bucket => 'xxxxxx',
    :s3_credentials => S3_CREDENTIALS

Still working on making it conditional for development & production

1- I have the same issue, and I solved it, when i configure the dynamic linker run-time bindings to create the necessary links and cache to the most recent shared libraries using the ldconfig command.

So you need to use the following command:

sudo ldconfig /usr/local/lib

Actually, I advice to re-install imagemagick using steps at how-to-install-image-magick-and-setup-paperclip.

2- You need to add the following code in development.rb file:

Paperclip.options[:command_path] = "/usr/local/bin/"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!