Installed RMagick using 'gem install rmagick'
Here are last few lines...
--------------------------------------------------------------------------
gcc -fPIC -Wall -g -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick
-DRUBY_VERSION=0x184 -I/usr/include -c rmfill.c
gcc -fPIC -Wall -g -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick
-DRUBY_VERSION=0x184 -I/usr/include -c rminfo.c
gcc -fPIC -Wall -g -I. -I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/1.8/i386-linux
-I/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick
-DRUBY_VERSION=0x184 -I/usr/include -c rmmain.c
gcc -shared -L/usr/lib -lfreetype -lz -L/usr/lib -L"/usr/lib" -o
RMagick.so rmilist.o rmdraw.o rmutil.o rmimage.o rmfill.o rminfo.o
rmmain.o -lMagick -llcms -ltiff -lfreetype -ljpeg -lgs -lXext -lSM -lICE
-lX11 -lXt -lbz2 -lz -lpthread -lm -lpthread -lruby -ldl -lcrypt -lm
-lc
make[1]: Leaving directory
`/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick'
setup.rb: entering post-setup phase...
post-setup.rb: setting up documentation...
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick Adispatch.rb
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick
InitialCoords.rb
post-setup.rb: InitialCoords.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick NewCoordSys.rb
post-setup.rb: NewCoordSys.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick OrigCoordSys.rb
post-setup.rb: OrigCoordSys.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick
PreserveAspectRatio.rb
post-setup.rb: PreserveAspectRatio.rb example returned error code 256
/usr/bin/ruby -I /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./lib -I
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/./ext/RMagick RotateScale.rb
post-setup.rb: RotateScale.rb example returned error code 256
make install
/usr/bin/ruby setup.rb install
post-install.rb: installing documentation...
Successfully installed rmagick-1.13.0
------------------------------------------------------------------------
'post-setup.rb' error codes worry me...
Tried using it anyway as installation reported as 'successful' anyway.
Rails complained about not finding the methods.
tried testing the "require 'RMagick'" in irb.
------
LoadError: no such file to load -- RMagick
from (irb):1:in `require'
from (irb):1
------
tried the sample script from the 'Users Guide'
------
require 'RMagick'
include Magick
cat = ImageList.new("Cheetah.jpg")
cat.display
exit
-------
Results:
-------
Rmagicktest.rb:1:in `require': no such file to load -- RMagick
(LoadError)
from Rmagicktest.rb:1
-------
Checked locations of Rmagick.so and libMagick.so
-------
locate RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick/RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
locate libMagick.so
/usr/lib/libMagick.so
/usr/lib/libMagick.so.9
/usr/lib/libMagick.so.9.0.4
-------
No 'usr/local/lib/ to worry about...
Any ideas on where to look/ how to fix?
Thanks,
Lance F. Squire
--
Posted via http://www.ruby-forum.com/.
If you are using a library installed with gems, you will need to
require 'rubygems'
first. Give that a try.
-Justin
Try to run following line
ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;"
what do you see??
Also you could read this article - you could find some interesting
things about RMagick
http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html
> Try to run following line
> ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;"
> what do you see??
>
> Also you could read this article - you could find some interesting
> things about RMagick
>
> http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html
$ ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;"
This is RMagick 1.13.0 ($Date: 2006/06/26 23:32:37 $) Copyright (C) 2006
by Timothy P. Hunter
Built with ImageMagick 6.2.5 05/25/06 Q16
file:/usr/share/ImageMagick-6.2.5/doc/index.html
Built for ruby 1.8.4 (2005-12-24) [i386-linux]
Web page: http://rmagick.rubyforge.org
Email: rma...@rubyforge.org
--------
Interesting.... That seems to work....
Reading website...
> Also you could read this article - you could find some interesting
> things about RMagick
>
> http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html
Um... This is FC4 no sudo to worry about (there is a root account to
work from)
libs ARN'T in 'usr/local/lib' they are in 'usr/lib' (see top)
Running the irb or ruby tests above produce the same results under root.
Still stumped...
Lance
> Anatol Pomozov wrote:
>
>> Also you could read this article - you could find some interesting
>> things about RMagick
>>
>> http://blog.pomozov.info/posts/adventure-with-rmagick-and-mongrel.html
>
> Um... This is FC4 no sudo to worry about (there is a root account to
> work from)
you should never, never compile as root. fyi.
>
> libs ARN'T in 'usr/local/lib' they are in 'usr/lib' (see top)
and do you have ld.so configured to look there?
-a
--
we can never obtain peace in the outer world until we make peace with
ourselves.
- h.h. the 14th dali lama
Add explicit
require 'rebygems'
to your code then
require 'rubygems'
require 'RMagick'
include Magick
cat = ImageList.new("Cheetah.jpg")
cat.display
exit
--
Posted via http://www.ruby-forum.com/.
This dose make the test code from the 'Users guide' work.
Though you would think they would have included it....
Lance
Unfortunatly, no love from rails...
Lance
Yes, but I must 'su' for the 'gem install rmagick' to work properly.
>>
>> libs ARN'T in 'usr/local/lib' they are in 'usr/lib' (see top)
>
> and do you have ld.so configured to look there?
>
Well, as Rails is working properly, and was installed the same way, I
presume that ld.so is pointing to 'usr/lib'
Can't find relevent ld.so to check...
# locate ld.so
/etc/ld.so.cache
/etc/ld.so.conf
/etc/ld.so.conf.d
/etc/ld.so.conf.d/mysql-i386.conf
/etc/ld.so.conf.d/qt-i386.conf
/usr/lib/librpmbuild.so
/usr/lib/kde3/kded_kssld.so
/usr/share/doc/man-pages-ja-20060115/translation_lists/ld.so.translation_list
/usr/share/man/ja/man8/ld.so.8.gz
/usr/share/man/man8/ld.so.8.gz
> unknown wrote:
>>
>> you should never, never compile as root. fyi.
>>
>
> Yes, but I must 'su' for the 'gem install rmagick' to work properly.
that means you are compiling as root. if the installs uses non-standard
library paths (LD_RUN_PATH or -r switch to ld.so) they will then fail at
runtime as doing this as root is silently ignored.
>>> libs ARN'T in 'usr/local/lib' they are in 'usr/lib' (see top)
>>
>> and do you have ld.so configured to look there?
>>
>
> Well, as Rails is working properly, and was installed the same way, I
> presume that ld.so is pointing to 'usr/lib'
rails doesn't require a properly configured ld.so since it uses now shared
libs
> Can't find relevent ld.so to check...
>
> # locate ld.so
> /etc/ld.so.cache
> /etc/ld.so.conf
> /etc/ld.so.conf.d
> /etc/ld.so.conf.d/mysql-i386.conf
> /etc/ld.so.conf.d/qt-i386.conf
> /usr/lib/librpmbuild.so
> /usr/lib/kde3/kded_kssld.so
> /usr/share/doc/man-pages-ja-20060115/translation_lists/ld.so.translation_list
> /usr/share/man/ja/man8/ld.so.8.gz
> /usr/share/man/man8/ld.so.8.gz
to check - find the '*.so' created by the 'gem instann rmagick' command, then
do something like
ldd RMagick.so
for instance
jib:~ > ldd /dmsp/reference/ruby-1.8.1/lib/ruby/site_ruby/1.8/i686-linux/RMagick.so
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x0086e000)
libz.so.1 => /usr/lib/libz.so.1 (0x002d6000)
libMagick.so.6 => /dmsp/reference/lib/libMagick.so.6 (0x00c1f000)
libtiff.so.3 => /dmsp/reference/lib/libtiff.so.3 (0x00e82000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x0068f000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x00ad4000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x00578000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x00111000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x00128000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x009c1000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x00e08000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00207000)
libm.so.6 => /lib/tls/libm.so.6 (0x0079a000)
libdl.so.2 => /lib/libdl.so.2 (0x003f7000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x0053a000)
libc.so.6 => /lib/tls/libc.so.6 (0x00ae2000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00506000)
-a
--
happiness is not something ready-made. it comes from your own actions.
This at least gives me a new error message.
----
uninitialized constant RMagick
should I then remove the package and again attempt to install as user?
(Thought I installed rails as user, but could not get rmagick to install
that way...)
> to check - find the '*.so' created by the 'gem instann rmagick' command,
> then
found:
]$ locate RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick/RMagick.so
/usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
> do something like
>
> ldd RMagick.so
>
$ ldd /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/lib/RMagick.so
linux-gate.so.1 => (0x00168000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00385000)
libz.so.1 => /usr/lib/libz.so.1 (0x00fe5000)
libMagick.so.9 => /usr/lib/libMagick.so.9 (0x00ba8000)
liblcms.so.1 => /usr/lib/liblcms.so.1 (0x00e55000)
libtiff.so.3 => /usr/lib/libtiff.so.3 (0x00111000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00184000)
libgs.so.8 => /usr/lib/libgs.so.8 (0x00ff8000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x001a6000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x007b1000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x006ce000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x001b6000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x00ef9000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x002b3000)
libpthread.so.0 => /lib/libpthread.so.0 (0x002c3000)
libm.so.6 => /lib/libm.so.6 (0x002d7000)
libruby.so.1.8 => /usr/lib/libruby.so.1.8 (0x003f3000)
libdl.so.2 => /lib/libdl.so.2 (0x002fc000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00889000)
libc.so.6 => /lib/libc.so.6 (0x004ed000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00300000)
libcupsimage.so.2 => /usr/lib/libcupsimage.so.2 (0x00328000)
libcups.so.2 => /usr/lib/libcups.so.2 (0x0075a000)
libssl.so.6 => /lib/libssl.so.6 (0x0033f000)
libcrypto.so.6 => /lib/libcrypto.so.6 (0x008b7000)
libnsl.so.1 => /lib/libnsl.so.1 (0x004d3000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x009ec000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x004e9000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00fb5000)
/lib/ld-linux.so.2 (0x00169000)
libgnutls.so.12 => /usr/lib/libgnutls.so.12 (0x00620000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0069b000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00ad9000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x006b4000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x006e8000)
libresolv.so.2 => /lib/libresolv.so.2 (0x006b7000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0070d000)
libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x0082c000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00e37000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x006ca000)
and
]$ ldd /usr/lib/ruby/gems/1.8/gems/rmagick-1.13.0/ext/RMagick/RMagick.so
linux-gate.so.1 => (0x00168000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x006a1000)
libz.so.1 => /usr/lib/libz.so.1 (0x00d3f000)
libMagick.so.9 => /usr/lib/libMagick.so.9 (0x00184000)
liblcms.so.1 => /usr/lib/liblcms.so.1 (0x00487000)
libtiff.so.3 => /usr/lib/libtiff.so.3 (0x00cd9000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00125000)
libgs.so.8 => /usr/lib/libgs.so.8 (0x00f52000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00c0b000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x004c5000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x0079a000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x004ce000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x003b2000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0x00111000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00147000)
libm.so.6 => /lib/libm.so.6 (0x00449000)
libruby.so.1.8 => /usr/lib/libruby.so.1.8 (0x007b4000)
libdl.so.2 => /lib/libdl.so.2 (0x00e7e000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00db5000)
libc.so.6 => /lib/libc.so.6 (0x00894000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x0076d000)
libcupsimage.so.2 => /usr/lib/libcupsimage.so.2 (0x0040b000)
libcups.so.2 => /usr/lib/libcups.so.2 (0x005cb000)
libssl.so.6 => /lib/libssl.so.6 (0x00601000)
libcrypto.so.6 => /lib/libcrypto.so.6 (0x009c7000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00422000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00afc000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00d75000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x0015b000)
/lib/ld-linux.so.2 (0x00169000)
libgnutls.so.12 => /usr/lib/libgnutls.so.12 (0x00c1b000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0046e000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00de3000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x00121000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00646000)
libresolv.so.2 => /lib/libresolv.so.2 (0x0066b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00438000)
libgcrypt.so.11 => /usr/lib/libgcrypt.so.11 (0x0070f000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00161000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00444000)
Sorry for longish posts...
> Sorry for longish posts...
no prob.
it looks RMagick compiled ok - otherwise you wouldn't have an so...
what do these commands do for you
harp:~ > ruby -r rubygems -e' require "RMagick"; p Magick '
Magick
if that doesn't work try
harp:~ > LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e' require "RMagick"; p Magick '
Magick
??
ah.
__that__ is your problem
it's Magick - not RMagick!
> what do these commands do for you
>
> harp:~ > ruby -r rubygems -e' require "RMagick"; p Magick '
> Magick
>
$ ruby -r rubygems -e' require "RMagick"; p Magick '
----
Magick
----
$ ruby -r rubygems -e' require "RMagick"; p Magick 'Magick
----
-e:1: warning: parenthesize argument(s) for future version
-e:1: undefined method `Magick' for #<Object:0xb7f3f970> (NoMethodError)
----
> if that doesn't work try
>
> harp:~ > LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e' require
> "RMagick"; p Magick '
> Magick
>
$ LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e' require
"RMagick"; p Magick '
-----
-e:1:in `require': wrong number of arguments (0 for 1) (ArgumentError)
from -e:1
-----
changing:
require 'rubygems'
require_gem 'rmagick'
include RMagick
to:
require 'rubygems'
require_gem 'rmagick'
include Magick
strangly produces this message:
undefined method `include' for #<MyBountyController:0xb796d1d4>
> unknown wrote:
>
>> what do these commands do for you
>>
>> harp:~ > ruby -r rubygems -e' require "RMagick"; p Magick '
>> Magick
>>
>
> $ ruby -r rubygems -e' require "RMagick"; p Magick '
> ----
> Magick
> ----
therefore, you've got it installed. if you are having issues with rails you
have issues with permissions or you have two rubys installed and the web users
is using a different one
> $ ruby -r rubygems -e' require "RMagick"; p Magick 'Magick
> ----
> -e:1: warning: parenthesize argument(s) for future version
> -e:1: undefined method `Magick' for #<Object:0xb7f3f970> (NoMethodError)
> ----
cut and past error. this is fine
>
>
>> if that doesn't work try
>>
>> harp:~ > LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e' require
>> "RMagick"; p Magick '
>> Magick
>>
>
> $ LD_LIBRARY_PATH=/usr/lib ruby -r rubygems -e' require
> "RMagick"; p Magick '
> -----
> -e:1:in `require': wrong number of arguments (0 for 1) (ArgumentError)
> from -e:1
that has to be on one line!
anyhow. you have installed RMagick and can use it fine from the command line.
what's your exact issue in rails then?
This may or may not have happened when I tried to upgrade the version of
rails.
Don't know how to check and or rectify...
>
> anyhow. you have installed RMagick and can use it fine from the command
> line.
> what's your exact issue in rails then?
>
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:
def make_thumb(location, image, thumb)
require 'rubygems'
require_gem '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
modified from this site:
http://www.bigbold.com/snippets/tag/rmagick
(bottom 2 examples)
> 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.
O.K.... :)
Still no Love...
This change:
def make_thumb(location, image, thumb)
require 'rubygems'
require_gem 'RMagick'
include Magick
pic = Magick::Image.read(location + image)
Produces this error:
Could not find RubyGem RMagick (> 0.0.0)
Thanks,
Guess I'll be moving this to a 'Rails can't see RMagick' thread...
> unknown wrote:
>> rest assured though,
>> you have
>> correctly installed RMagick.
>>
>> good luck.
>>
>> -a
>
> Thanks,
>
> Guess I'll be moving this to a 'Rails can't see RMagick' thread...
that's not the issue. rails is ruby. if ruby sees it rails sees it. what
might not see it is you web user's account, or some other variant.
try this from you rails root
./script/console
require 'RMagick'
p Magick
i'll bet it works
Might help if I know what constitutes 'works' is ;)
Here's the output:
$ script/console
Loading development environment.
>> require 'RMagick'
=> true
>> p Magick
Magick
=> nil
> unknown wrote:
>> try this from you rails root
>>
>> ./script/console
>>
>> require 'RMagick'
>>
>> p Magick
>>
>>
>> i'll bet it works
>>
>> -a
>
> Might help if I know what constitutes 'works' is ;)
>
> Here's the output:
>
> $ script/console
> Loading development environment.
>>> require 'RMagick'
> => true
>>> p Magick
> Magick
> => nil
>>>
so, there you have it - ruby, rmagick, and rails altogether. any errors you
have now are, unfortunately, purely bugs in your own code ;-(
in this one
it's
require 'rubygems'
require 'RMagick'
not just
require 'RMagick'
in this one
it's
Magick
not
RMagick
in this one
you are running the requires and includes at instance, not class level
etc.
you've got everything installed correctly and rails sees it too. now you've
just got to work out the bugs.
regards.
Thanks for the debugging/verifying so far.
(Just got back to the project)
I have tried moveing the:
require 'rubygems'
require_gem 'RMagick'
above and just below the "class" line in the controller. In either case
I get:
-----
Gem::LoadError in <controller not set>#<action not set>
Could not find RubyGem RMagick (> 0.0.0)
-----
Contrary to the previous tests this is telling me that it cant find
RMagick...
lance
After Much more Googleing for working code samples.
I notice that they All had the "require 'RMagick'" under the 'def' line.
This put me back to the error:
----
undefined method `columns' for #<Array:0xb791c810>
----
I have long forgotten why I removed the '.first' from the:
pic = Magick::Image.read(location + image).first
line, so I replaced it.
NOW things started giving me errors I could understand!!!
As the latest sample was far more eloquent than the original I was
trying to use, I substuted it for some of the code that wasn't working,
beacuse I missed something from the original code.
This is the result:
def make_thumb(location, image, thumb)
#require 'rubygems'
#require_gem 'RMagick'
#include Magick
require 'RMagick'
pic = Magick::Image.read(location + image).first
#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)
pic.change_geometry!('64x64') { |cols, rows, img|
pic.resize!(cols, rows)}
white_bg = Magick::Image.new(64, 64)
pic = white_bg.composite(pic, Magick::CenterGravity,
Magick::OverCompositeOp)
pic.write(location + thumb)
end
or more cleaned-up as:
def make_thumb(location, image, thumb)
require 'RMagick'
pic = Magick::Image.read(location + image).first
pic.change_geometry!('64x64') { |cols, rows, img|
pic.resize!(cols, rows)}
white_bg = Magick::Image.new(64, 64)
pic = white_bg.composite(pic, Magick::CenterGravity,
Magick::OverCompositeOp)
pic.write(location + thumb)
end
This code works flawlessly!
Unfortunatly, My original attempts to fix the original error were,
misguided and caused more errors than could probably be debugged
remotly.
Much thanks for conferming that RMagick was installed and working
properly.
Lance F. Squire