Re: RMagick at dreamhost

Tim Hunter
Sat, 03 Feb 2007 22:07:09 -0000

Constantin Gavrilescu wrote:
> I''m getting the crazy error "undefined method
`resize_to_fit'' for
> #<Magick::Image:0x41b74904>"
>
> I have RMagick on dreamhost, but no resize_to_fit method? Am I missing
> something?

You may be missing a sufficiently recent version of RMagick. The
resize_to_fit method was added in version 1.11.0. What version of
RMagick is installed? Try this:

ruby -r RMagick -e"puts Magick::Long_version"

If the version is older than 1.11.0, you can add it yourself. The
Image#resize_to_fit method is extremely simple to write. The code for it
in RMagick.rb is this:

    def resize_to_fit(cols, rows)
        change_geometry(Geometry.new(cols, rows)) do |ncols, nrows|
            resize(ncols, nrows)
        end
    end