Search code examples
ruby-on-railsimagemagickpapercliprmagick

Unknown error with Paperclip and ImageMagick - Rails 2


I am using PaperClip and ImageMagick to upload and generate images in my Rails 2.2.2 application.

It was working fine. But now when uploading image, the different sizes of image which gets generated at the time of upload is not working. The image is getting uploaded.

I am getting the following error in log.

 INFO  production : [paperclip] /usr/local/bin/identify -format "%w" /www/hosts/{path}

 INFO  production : <Paperclip::PaperclipCommandLineError> Error while running identify

 /www/hosts/{path}/vendor/plugins/paperclip/lib/paperclip.rb:101:in `run'

I can't understand what is happening here. I checked the path of identify using which identify which returned user/local/bin/identify.

The Paperclip in config is as

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

Any idea what is happening here??

I tried to add a Paperclip custom validation to the model. I think the image upload went wrong after this validation. I have removed it. But still not working.

This is the line of code which stops it all in square_up function.

Paperclip.run('identify', args).strip

The Paperclip is not able to process image.img format.

The symlink master.img is not generated properly. A symlink is created as master.png and it points to master.img. The symlink should be master.img which points to the real image uploaded.


Solution

  • I uninstalled and reinstalled ImageMagick from source. The decode delegate libraries for jpeg and png were missing. Installed them individually by yum install libpng libpng-devel and yum install libjpg libjpg-devel .

    After that reinstalled ImageMagick and everything works fine.