Search code examples
ruby-on-railsimagemagickpaperclipimage-uploadingrmagick

Paperclip image upload in rails


I am using paperclip for image uploading and in my model I have specified styles to store the images with various sizes, I have imagemagick installed, here are the codes

 has_attached_file :image,
                    styles: { medium: '300x300>', thumb: '40x40>' },
                    path: 'images/:id/image/:basename.:extension',
                    default_url: 'default.png'
  validates_attachment :image, content_type: { content_type: %w[image/jpeg image/png] }


It doesn't seems to store images with these specified styles, It only stores image with default style. Do I miss anything here?. Thanks in advance


Solution

  • enter image description here

    I did a mistake by overriding the paperclip default path without :style specified. So it stores only the default size. The processed image (by ImageMagick) does not store as I didn't mention at override path.