Topic: crop_resized with acts_as_attachment

I am uploading an image using acts_as_attachment. Acts_as_attachment supports resizing using RMagick, but in this case I need to not only resize an uploaded image, but also to make sure that the aspect ratio matches some predetermined dimensions. I believe that the best way to do this is by employing RMagick's crop_resized method. Is it possible to call this method using acts_as_attachment?

I thought about how mothers feed their babies with tiny little spoons and forks, so I wondered what do Chinese mothers use. Toothpicks?

Re: crop_resized with acts_as_attachment

As far as I can tell acts_as_attachment doesn't give any interface for specifying precisely how RMagick handle's the file.  If anybody else wants to see if they can find something I missed, the code's here:

http://svn.techno-weenie.net/projects/p … achment.rb

Man, Rick's plugins are awesome.

Re: crop_resized with acts_as_attachment

I don't know if acts_as_attachment is handles image cropping, but file_column does.

Re: crop_resized with acts_as_attachment

I was apprehensive to use file_column because, as far as I can tell, it's no longer being actively developed.

I was, however, pleased to find out that file_column's RMagick wrapper does seem much more robust than acts_as_attachment's:

  # == Cropping images
  #
  # If you wish to crop your images with a size ratio before scaling
  # them according to your version geometry, you can use the :crop directive.
  #    file_column :image, :magick => {:versions => {
  #         :square => {:crop => "1:1", :size => "50x50", :name => "thumb"},
  #         :screen => {:crop => "4:3", :size => "640x480>"},
  #         :widescreen => {:crop => "16:9", :size => "640x360!"},
  #       }
  #    }

I'll definitely be giving it a try. Hopefully it still works with Edge...

I thought about how mothers feed their babies with tiny little spoons and forks, so I wondered what do Chinese mothers use. Toothpicks?

Re: crop_resized with acts_as_attachment

I found an article about this here:
http://www.toolmantim.com/article/2006/ … attachment

Re: crop_resized with acts_as_attachment

zattrix wrote:

I found an article about this here:
http://www.toolmantim.com/article/2006/ … attachment

Cool. Thanks for taking the time to post it smile

I thought about how mothers feed their babies with tiny little spoons and forks, so I wondered what do Chinese mothers use. Toothpicks?