BACKTRACE

(condense)

Back to Posts List

GET

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 use ImageScience instead (RMagick is out of the question of course).

sudo gem install image_science

this will include all most all dependencies, but 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!.

POST

blog comments powered by Disqus

I Don't have cookies.

ELAD ENV

Variable Value
LINKEDIN
TWITTER
FACEBOOK
GITHUB
WWR
IRC
{ 'irc.freenode.net' => [ '#rubyonrails', '#railsbridge', '#ruby', '#mootools' ]}
SKYPE
eladmeidar

You're seeing this error because I think it is funny.