Follow Along as I Stumble on the Path to Learning RoR


Rails Paperclip Error: identify ‘-format’ ‘%wx%h’

I was receiving the “identify ‘-format’ ‘%wx%h’ ” error with Paperclip.  The reason is because Paperclip requires ImageMagick if images are manipulated, and the path must be specified for this to happen.  In order to find the path in Windows, what I did was:

  1. open a command prompt (CMD from the start menu)
  2. navigate to c://
  3. type “PATH”
  4. it should show the path(s) that can be used for ImageMagick
  5. I added this line to development.rb

Paperclip.options[:command_path] = “/bin” #(in place of “/bin” put your path)

Restart your server.

Deleting a Paperclip Attachment

In order to delete an attachment, follow this syntax, where:

@page => controller
image =>  attachment name

@page.image.destroy #Will remove the attachment and save the model