Paperclip: How to resize an image only if it is big enough?

Viewed 3822

I use Paperclip to resize pictures like this:

class Asset < ActiveRecord::Base
  has_attached_file :asset, :styles => { :thumb => "80x80#", 
                                         :medium => "1280x800>" }, ...

When the size of the original picture is 32x32:

  1. The resulting medium picture is of the same size (i.e. 32x32), but the file is a bit different and the picture looks a bit changed. Why is that ?

  2. The resulting thumb size is 80x80 (it looks stretched to fit this size). How could I avoid resizing the picture when it's too small. Assume that original picture's dimensions are in the width and height variables.

1 Answers
Related