How to get acts_as_attachement plugin working on mac osx

28 10 2007


If you want to use acts as attachement for image upload/manipulation as well then first you need to install imagemagick (and its dependencies) and RMagick.

Before installing imagemagick you also need to install the following libraries as well:

1) libjpeg

Download it from http://www.ijg.org/files/jpegsrc.v6b.tar.gz

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure –enable-shared –enable-static
make
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a

2) libpng

Download it from http://www.libpng.org

tar zxvf libpng-1.2.22.tar.gz
cd libpng*
./configure
make check
sudo make install
sudo ranlib /usr/local/lib/libpng.a

3) freetype

Download it from http://download.savannah.nongnu.org/releases/freetype/

tar zxvf freetype-2.3.5.tar.gz
cd freetype*
./configure
make
sudo make install

4) libwmf

Download it from http://wvware.sourceforge.net/libwmf.html

tar zxvf libwmf-0.2.8.tar.gz
cd libwmf*
./configure
make check
sudo make install

5) ghostscript

Download it from http://pages.cs.wisc.edu/~ghost/doc/gnu/index.htm

tar zxvf ghostscript-8.01.tar.gz
cd ghostscript*
./configure
make
sudo make install

Imagemagick installation
Download it from http://www.imagemagick.org/script/download.php

tar zxvf Imagemagick-6.3.2.tar.gz

cd Imagemag*
export CPPFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib
./configure –prefix=/opt/local –disable-static –with-modules –without-perl \
–without-magick-plus-plus –with-quantum-depth=8 \
–with-gs-font-dir=/opt/local/share/ghostscript/fonts
make
sudo make install

RMagick Installation
If ruby and gem package manager is installed on your machine then simply do
sudo gem install rmagick
To check whether it is installed properly;
- go to terminal and run
irb -rubygems -r RMagick
irb(main):001:0> puts Magick::Long_version

this should give you the following output

This is RMagick 1.15.10 ($Date: 2007/06/09 16:45:25 $) Copyright (C) 2007 by Timothy P. Hunter
Built with ImageMagick 6.3.2 10/28/07 Q8 http://www.imagemagick.org
Built for ruby 1.8.6 (2006-12-25 patchlevel 0) [i686-darwin8.9.1]]
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org

Installing rmagick from source

tar xvzf RMagick.tar.gz
cd RMagick*
./configure
make
sudo make install

Using Act_as_attachment
I was about to write this but then I found a very good tutorial on installing and using acts_as_attachment here.


Sign up and be a part of SPhred.com and don’t forget to invite your friends ;o)






How to get Gruff working with Rails on windows

24 10 2007

NOTE: You can’t do gem install rmagick on windows since (as of now) rmagick gem is only for *nix systems

1) Download rmagick-win32 from http://rubyforge.org/frs/?group_id=12&release_id=15197

This also has imagemagick for 8 pixels so you don’t need to do a separate download for imagemagick. If you want imagemagick for 16 pixels then download it from here http://www.imagemagick.org/script/binary-releases.php

Imagemagick site says ‘16 bitversion permits you to read or write 16-bit images without losing precision but requires twice as much resources as the Q8 version.’

3) Install Imagemagick

To confirm if imagemagick is installed properly go to your command prompt and type

convert logo: logo.gif
identify logo.gif
imdisplay logo.gif

this should display the imagemagick logo if everything was ok

4) Go to your command prompt and run gem update --system

5) Go the directory where you unzipped the downloaded rmagick-win32 file

6) Run gem install rmagick --local

after it is installed successfully then you should see

Successfully installed rmagick, version 1.15.9

7) Either run gem install gruff

OR

to use rails plugin. Go to your app root directory and run

ruby script/plugin install http://topfunky.net/svn/plugins/gruff

And you are done…


Sign up and be a part of SPhred.com and don’t forget to invite your friends ;o)