The problem was that my ImageMagick didn't have JPEG delegates. I found out using convert -list format
. So I reinstalled ImageMagick
using MacPorts and reinstalled rmagick
with the new Paths to ImageMagick.
Paperclip error - NotIdentifiedByImageMagickError
-
23-07-2023 - |
문제
I'm trying to upload images to aws s3 with paperclip but I get this error
Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1u773ft.jpg'
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-kfejir.jpg'
In my model, I set up these styles
has_attached_file :photo, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:style/:id/:filename", :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/assets/profile/iama.png"
When I remove these styles, everything works, but I really need them.
I'm using Rails 3.2.16
and
paperclip (4.1.1)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
I already installed ImageMagick
and the rmagick
gem
Help me please.
해결책
다른 팁
I had similar issue and updating imagemagick resolved that. You might want to try that out as well.
I had the same problem on my mac. Resolved it by installing GhostScript
brew install gs
as paperclip documentation says: http://rdoc.info/gems/paperclip/frames/file/README.md
In my case I had a dirty ImageMagick installation (v7.0) that I installed manually before using rpm. This one doesn't showed me all dependencies that ImageMagick needed so Paperclip crashed when it tried to use convert or identify commands.
I recommend, for Unix users to install using yum or apt-get for installing all the dependencies correctly. Also recommend to install ghostscript in case that commands identify and convert cannot be summoned from paperclip.
cd ImageMagick-7.0.3-0
make uninstall
yum install ImageMagick ImageMagick-devel
Please follow this link for more specific details: How to Install ImageMagick on CentOS & RHEL
Rubygems used: paperclip (5.1.0) cocaine (0.5.8)
Installing libmagickwand-dev seemed to sort it out.
- sudo apt autoremove imagemagick
- rm /usr/bin/convert and rm /usr/bin/convert-im6
- sudo apt-get install imagemagick
- sudo apt-get install libmagickwand-dev
sudo apt install ffmpeg
ImageMagick delegates video processing. I lost more than 5 hours to understand why such a bug NotIdentifiedByImageMagickError
install make https://www.imagemagick.org/discourse-server/viewtopic.php?t=24284
I had the same problem, and in addition to reinstalling everything (ImageMagick, libtool
, ghostscript
, jpeg
), and finally running a general brew update && brew upgrade
, I also had to relink freetype
:
brew unlink freetype && brew link freetype
I had the same problem but i remove styles and applicattion started works
has_attached_file :picture
validates_attachment_content_type :picture, content_type: /^image\/(png|gif|jpeg|jpg)/
I also faced the same problem on Ubuntu 18 server.
You can check for the delegates installed with Imagemagick using the below command:
convert --version
I found some missing delegates after installs like the JPEG/JPG or PNG.
I purged the Imagemagick packages and then installed the required dependencies for JPEG/JPG and PNG using below command:
sudo apt-get install build-essential checkinstall libx11-dev libxext-dev zlib1g-dev libpng12-dev libjpeg-dev libfreetype6-dev libxml2-dev
Then tried to install Imagemagick with the latest version and it worked.
From here
OLD syntax - :styles => { :medium => "300x300>" }
New syntax - style: { :medium => "300x300>" }