Trying to use Rmagick to make thumbnails of images previously stored on
the drive.You've seen the errors above. here is the code as it stands now:
all your erros showed the constant 'RMagick' - that doesn't exist. it's
Magick, as you've got below. somewhere in your code you've got the constant
RMagick if you're actually getting the error shown.
def make_thumb(location, image, thumb)
require 'rubygems'
require_gem 'rmagick'
this is 'RMagick' not 'rmagick'
include Magick
pic = Magick::Image.read("#{location}#{image}")
imgwidth = pic.columns
imgheight = pic.rows
imgratio = imgwidth.to_f / imgheight.to_f
imgratio > aspectratio ? scaleratio = 64 / imgwidth : scaleratio =
64 / imgheight
thumb = pic.resize(scaleratio)white_bg = Magick::Image.new(64, thumb.height)
pic = white_bg.composite(thumb, Magick::CenterGravity,
Magick::OverCompositeOp)
pic.write("#{location}#{thumb}")
end
in short
- you've got RMagick installed correctly
- you've posted two errors caused by typos
1) RMagick vs Magick
2) require 'rmagick' vs. require 'RMagick'
the example i posted showed how to do both correctly.
for this you should be able to find your error. rest assured though, you have
correctly installed RMagick.
good luck.
-a
···
On Sat, 5 Aug 2006, Lance Squire wrote:
--
happiness is not something ready-made. it comes from your own actions.
- h.h. the 14th dali lama