If you are using a plugin such as simple_captcha that requires RMagick, then you may encounter the following error during the rendering of jpeg catpcha image on Linux: (seen in the logs)
ArgumentError (unknown format: JPG):
/vendor/plugins/simple_captcha/lib/simple_captcha_image.rb:95:in `format='
This mean that we need to install the delegate library for JPEG.
1. do apt-get install libjpeg62 (not sure if this is required or just dev is enough)
2. do apt-get install libjpeg62-dev
3. cd to where you downloaded Imagemagick and do ./configure, make, make install.
The result of ./configure will summarize the status of deletgate libraries in the end.
After this, a blank image should start to show up in place of the simple_catpcha image and the logs may show something like this:
sh: gs: command not found
sh: gs: command not found
RMagick: unable to read font `(null)'.
RMagick: Postscript delegate failed `/tmp/magick-XXfm5AzA': No such file or directory.
sh: gs: command not found
sh: gs: command not found
RMagick: unable to read font `(null)'.
RMagick: Postscript delegate failed `/tmp/magick-XXg7z0RL': No such file or directory.
4. Do apt-get install ghostscript if simple_captcha image shows up as a white blank image, without any letters. Don't forget to do ./configure, make, make install from your Imagemagick source dir after this. Restarting of the server will be required for production environment.
Example result of ./configure status.
Delegate Configuration:
....
JPEG v1 --with-jpeg=yes yes
FreeType --with-freetype=yes yes
...
These 4 delegate libraries got simple_captcha working.
1. libfreetype6-dev (This also seems to be for fonts, but didn't cut it for simple_captcha, but I had installed it already, so I let it be.)
2. libjpeg62-dev
3. libpng12-dev ( installed it just in case...)
4. ghostscript
Running ./configure, make, make install from imagemagick source dir is necessary after installing the above libraries.
If captcha image is not getting recognized, you may need to run the following (for rails > 2.0, there is a separate command for older Rails which can be seen from the simple_captcha website.)
rake simple_captcha:setup
then run
rake db:migrate
Thursday, January 31, 2008
Getting simple_captcha image to show up on Ubuntu Linux
Posted by
Sonal
at
10:22 PM
Labels: ImageMagick, libjpeg62-dev Ubuntu, Rmagick, Ruby on Rails, simple_captcha delegate libraries, simple_captcha fonts error
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment