Oracle Blog

Prashant Srinivasan's Weblog

installing ImageScience an art?

ImageScience is a pretty cool gem to use in your Rails application for Thumbnail generation. It doesn't install correctly out of the box since ImageScience uses an incorrect default path for locating FreeImage. The Makefile shipped with FreeImage also does not build correctly on OpenSolaris. So here's a way to make sure it works correctly first time if you are on OpenSolaris.

Change directory into the exploded FreeImage source, and utter the following.

gmake -f Makefile.opensolaris

gmake -f Makefile.opensolaris install

Where Makefile.opensolaris is the OpenSolaris Makefile that you just downloaded.

Step5: The rbconfig.rb file in your Ruby installation needs to be changed. Edit this file(it's to be found in /usr/ruby/1.8/lib/ruby/1.8/i386-solaris2.11 )

Look for a line that goes thus:

CONFIG["LDSHARED"] = "ld -G"

and replace it with

CONFIG["LDSHARED"] = "$(CC) -G"

i.e., change the linker binary such that the GNU Linker is used by RubyInline(which is an ImageScience dependency).

This is a bug that will be fixed in build111. So if you have a newer version, this bug might already have been fixed.

Step6: Now install ImageScience the usual way.

gem install image_science

Step7: You should now be set. But, just to make sure, run the ImageScience tests and make sure they pass. Here is how to do that.

Edit $GEM_HOME/gems/image_science-1.1.3 test/test_image_science.rb (if you use the default gem home on OpenSolaris the file is to /var/ruby/1.8/gem_home/gems/image_science-1.1.3 test/test_image_science.rb ).

Add the following line to the beginning of the file.

require 'rubygems'

Now test it by executing:

cd /var/ruby/1.8/gem_home/gems/image_science-1.1.3

(or cd $GEM_HOME/gems/image_science-1.1.3 if your gem home is different).