file_column error --

well ive been trying to get either this plugin or acts_as_attachment to
work with my application, and neither have had any success. im going
back to looking for help with file_column, ive tried acts_as_attachment
all weekend, but im not getting any meaningful errors to help fix it,
and my application wont even start. file_column is also giving me
problems, but at the same time, I can at least access my application
and use it properly, the only time I have a problem with file_column is
when it needs to do anything with RMagick it seems. I can upload an
image fine simply by declaring file_column :filename in my model, but
when I goto add something like :geometry => it errors out with an ugly
ImageMagick error thing.

This is the code in my model:

file_column :filename, :magick => { :geometry => "640x480>" }

This is the error im getting below.

NameError in Admin/biographiesController#update
uninitialized constant ImageMagickError

This error occured while loading the following files:
   magick/image_magick_error.rb

PLEASE ask for more logs and try to be specific what I should be
looking for so I know what to include, im still new to this all, so im
not always 100% what I need to be doing all of the time..

The form is multipart, the fields are all working properly, but as soon
as I try to add the geometry / magick I get the error above.

I have successfully installed ImageMagick, and rmagick. I did the
convert logo.miff / imdisplay logo.miff thing and it worked properly, I
also did the examples in the rmagick gem folder, and those also worked
properly. I just used the basic install of ImageMagick, and told it to
update the executable search paths.. but if I need to manually set any
paths then I havent done that at all, so let me know about that as
well.

sorry about the huge message.. but im running out of options here and I
have no idea what on earth is causing it.. espically since everyone
else seems to get these working without any problems..

Thanks!!!!!!

try :size => “640x480>”

instead of :geometry => “640x480>”

do you have the RMagick gem installed???

do a ‘gem list’ from the console to check

hey, I tried replace :geometry with :size and I still get the same
error.

when I do gem list, I get the rmagick displayed, and as far as I can
tell it is working properly based on trying the provided examples.

gem list

rmagick <1.13.0>

     RMagick is an interface between Ruby and... etc

Im sure it will be easier to simply write my own script, I only need it
to resize gallery photos once they are uploaded, a few lines of code
can accomplish that im sure, would be nice to have this plugin work
though.. :frowning:

if ya wanna write your own

just ‘borrow’ the stuff from file column to help you get started

def resize_image(img, img_options, dest_path)
begin
if img_options[:crop]
dx, dy = img_options[:crop].split(’:’).map { |x| x.to_f }
w, h = (img.rows * dx / dy), (img.columns * dy / dx)
img = img.crop(::Magick::CenterGravity, [img.columns, w].min,
[img.rows, h].min)
end

    if img_options[:size]

      img = img.change_geometry(img_options[:size]) do |c, r, i|
        i.resize(c, r)
      end
    end
  ensure
    img.write dest_path
    File.chmod options[:permissions], dest_path

  end
end