Hi, this blog is no longer maintained, my new blog is here

Ruby On Rails and a Conning Israeli entrepreneur

attachment_fu and minimagick resize bug

In one of my latest projects i was using the attachement_fu plugin to handle image uploads.
The attachement_fu plugin enables the option to select an image processor engine between ImageScience, Rmagick add MiniMagick:

  1. Rmagick
    Kinda bulky, leaking but fully functional
  2. MiniMagick
    Simple version of Rmagick, simple and small.
  3. ImageSceince
    Small, nice, and quick.
i decided to use MiniMagick as my processor, i installed the gem:

sudo gem install mini_magick


and added a specific :processor option to my Logo model.

has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 2.megabytes,
:resize_to => 'x100',
:processor => :mini_magick


but when i was uploading an image, i was was expecting it to be resized based on the options i specified in the model. imagine how surprised i was when i found out that the image is not being resized.

checking the log found the following error:

Exception working with image: ImageMagick command (identify "/var/folders/Bv/Bvbna8-OH548ZWju8naF4U+++TI/-Tmp-/minimagick11451-0") failed: Error Given 32512


Googling it didn't help me much (except from finding other people with the same problem), so i decided to switch to ImageScience instead (RMagick is out of the question of course).

sudo gem install image_science


this will include all most all dependencies, the freeImage dependency is also needed.
us mac/darwin users can simply use port:

sudo port selfupdate
sudo port install freeimage


now change the processor in the model

has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 2.megabytes,
:resize_to => 'x100',
:processor => :image_science


and now it's working. yeah!.

1 comments:

  Jerome

November 30, 2008 at 5:34 PM

This is mostly a f@@@@ bug with the OS X port I also encounter. And a good reason to drop ImageMagick for "just" resizing.


The Web Ask eizesus.com

Subscribe

    follow me on Twitter

    Twiters Around

    About Me

    My photo
    I am a web developer for more than 9 years, managed, cried, coded, designed and made money in this industry. now trying to do it again.

    Labels