attachment_fu Not Resizing

Hello,

Recently attachment_fu stopped resizing images for me. I'm puzzled because before today it was resizing them and I don't know what's changed. Here's my code:

class Product < ActiveRecord::Base    has_attachment :content_type => :image,                   :storage => :file_system,                   :max_size => 18.megabytes,                   :resize_to => '300x',                   :thumbnails => { :thumb => '61x110!' }    validates_as_attachment end

I expected a 420x595 image to be resized to 300xWhatever and a 61x110 thumbnail to be created. The image and thumbnail product records were both created in the database but the images were left at the original size.

Strangely the width and height fields in the database are no longer being set. For new uploads they are null whereas previously they had been set to the measurements of the resized images.

I think I've traced the problem to this method (but I could equally well be barking up the wrong tree):

attachment_fu/processors/rmagick_processor.rb:

           module ClassMethods            # Yields a block containing an RMagick Image for the given binary data.            def with_image(file, &block)              begin                binary_data = file.is_a?(Magick::Image) ? file : Magick::Image.read(file).first unless !Object.const_defined?(:Magick)                puts "binary_data.nil? : #{binary_data.nil?}"                puts "file.nil?: #{file.nil?}"                puts "const_defined? : #{Object.const_defined?(:Magick)}"              rescue                # Log the failure to load the image. This should match ::Magick::ImageMagickError                # but that would cause acts_as_attachment to require rmagick.                logger.debug("Exception working with image: #{$!}")                binary_data = nil              end              block.call binary_data if block && binary_data            ensure              !binary_data.nil?            end          end

The puts statements give this output:

binary_data.nil? : true file.nil?: false const_defined? : false

So it looks like the undefined constant prevents binary_data from being assigned. But I don't know what to do about this.

I'd appreciate any help.

Thanks and regards, Andy Stewart

Just in case it helps you moving on in the development while this is understood, I found by chance that minimagick (which is enough for me) works fine.

-- fxn

Thanks for the suggestion.

RMagick does still work for me when I call it from straight Ruby -- which is what I am doing manually to resize images until my problem is fixed. This code looks like:

   require 'rubygems'    require 'RMagick'

   ...

   img = Magick::Image.read(image_file).first # image_file defined above in snipped code    img.change_geometry("300x") do |cols, rows, img|      img.resize(cols, rows)    end

So I think my RMagick installation is still okay....

Thanks for taking the time to reply (and sorry about my double post with slightly different titles...user malfunction!).

Regards, Andy Stewart