Installing an Image Processing Library - Gallery Codex
Personal tools

Installing an Image Processing Library

From Gallery Codex


Installing an image processing library is an essential part to install Gallery. We've tried to simplify the process quite a bit to aid in making the install painless.

Gallery 1 supports two processing libraries: NetPBM and ImageMagick. The Gallery Support Team recommends using NetPBM if you do not have administrator access on the machine, as we supply pre-compiled binaries for you to upload easily.

Gallery 2 supports four image toolkits: NetPBM, ImageMagick, GD and GraphicsMagick. They're all equally good, though some say that NetPBM has slightly better quality and that ImageMagick is slightly faster than NetPBM. GraphicsMagick and ImageMagick are very similar. GD can be very fast, but it will also use a lot of memory so it may cause you to run into predefined server limits. It is also compiled into PHP by default if your PHP is 4.3.0 or more recent, however it may not have support for all image types (e.g. it might not have JPEG support) and GD is also more error-prone than the other toolkits. If the binaries for NetPBM and ImageMagick are installed in default, or standard, locations then Gallery 2 will auto-detect them during Gallery 2 installation. It won't cause any harm to enable all of these toolkits—in fact you’ll get the widest file type support if you do so.

Note that the Gallery 2 modules called NetPBM and ImageMagick are not the toolkits, but the modules that enables Gallery 2 to use them. Do not enter the path to the gallery2/modules/netpbm or gallery2/modules/imagemagick in the toolkit setup in Gallery 2. Instead, point the modules where the actual binary files are located.


NetPBM

  1. Verify which architecure and operating system your server is running. You can either ask your host, or try entering your site's URL into http://www.netcraft.com/whats
Note: i386, i686, x86, ... are all intel compatible architectures (if you are unsure, try the intel / x86 binaries first)
  1. Download NetPBM binary package from the Gallery Download Page. Be sure to download the correct binaries for your system (see previous step). If Netcraft said your system is running "Linux," you can generally assume you want the linux-intel binaries, not linux-alpha
  2. Unzip the package and upload the extracted binaries to a subdirectory in your base Gallery directory (usually name the directory netpbm). Remember where you uploaded them
  3. Chmod the directory, and every file inside the directory 0755 (in graphical FTP clients, this is Owner -> Read, Write, Execute; Group -> Read, Execute; Other -> Read, Execute) It is very important that you chmod both the directory and every file inside
  4. Run the Configuration Wizard (Gallery 1) / Go to Site admin -> Plugins (Gallery 2) and enter the path to the NetPBM binaries (remember the path where you uploaded them) and hit save
Note: The path you're asked to enter must be an absolute filesystem path (not the address that you'd type in the browser). If you uploaded the NetPBM binaries yourself, the path will be very similar to the albums path (G1) / storage directory path (G2) that you can find in your Gallery config.php file.

Windows 2003 / IIS 6: See NetPBM for Windows 2003

ImageMagick

Information on how to install ImageMagick is available from their website. Installing from source and installing binary releases

Also, most Linux distributions offer ImageMagick via their respective package management interfaces.

Note that you will most likely need administrator access to the computer to be able to install ImageMagick. If you don't have that kind of access, you can either ask your host to install it for you or switch to using our precompiled NetPBM binaries instead.

Easy-to-install MacOS X packages can be found at www.entropy.ch

GD

GD is only supported by Gallery 2 & 3. Gallery 2 & 3 detects GD automatically. In site admin -> modules -> image toolkits GD, you can either activate it or not. If you can't activate it, then either your GD version is too old or more probably, GD is not loaded in your PHP. If your Gallery 2 is running on a webserver on a Windows platform and GD is not loaded, you have to uncomment a line in php.ini to load the GD extension:

Change
;extension=php_gd2.dll
to 
extension=php_gd2.dll

Why does GD cause my PHP script to run out of memory?

  • Most often, the problem is that the memory_limit parameter in php.ini is set to something very conservative, like 8M (eight megabytes). Increase that setting and restart the web server.
  • Of course, opening truly huge images can cause real memory problems, if several are open at once. 8,000 pixels times 8,000 pixels times four bytes for truecolor equals a walloping 256 megabytes.
  • Another real world example: Say you have an image that is 2576 X 1932
    • That is only a 1.4 Meg image compressed (jpeg)
    • Uncompressed: 2576 X 1932 X 4 = ~20Megs!
  • So the moral of this story: Use another toolkit.

GraphicsMagick

GraphicsMagick is only supported by Gallery 2. Gallery 2's imagemagick module works with binaries from either ImageMagick or GraphicsMagick.

Similar to ImageMagick, you can download either precompiled binaries or the source from GraphicsMagick Download Page.