Skip to content
Radio edited this page Jul 20, 2012 · 3 revisions

Since simplicity has been the main goal of this library, there's not a lot of configuration you need to do. However, there are a few configuration options for you to consider.

##PHP Configuration

To use the library, you don't really need to modify your PHP setup in any way. However, working with images is a pretty memory and CPU-intensive operation. If you plan on working with large images (say anything taken in high quality on a recent digital camera), you'll very likely need to increase PHP's memory limit in your php.ini file. I can't say what you should use, but I always try and set mine to at least half the available RAM on my server (within reason of course). Usually 128-256 MB works pretty well for large images. While this may seem like a lot of memory, keep in mind that it will only be in use while resizing the images, and is freed back up when manipulations complete.

##PHP Thumb Configuration

The only place you'll need to tweak config options is in the "ThumbLib.inc.php" file. For now, there's only two things you can really configure, and only one you should mess with if you're not sure what you're doing. If you take a look at the ThumbLib.inc.php file, you'll see a couple of static members on the PhpThumbFactory object. These are what you can tweak to your needs. Let's take a look at the one you'll likely change depending on your needs:

<?php
    ...
    define('DEFAULT_THUMBLIB_IMPLEMENTATION', 'gd');
    ...
    class PhpThumbFactory
    {
    	/**
    	 * Which implemenation of the class should be used by default
    	 * 
    	 * Currently, valid options are:
    	 *  - imagick
    	 *  - gd
    	 *  
    	 * These are defined in the implementation map variable, inside the create function
    	 * 
    	 * @var string
    	 */
    	public static $defaultImplemenation = DEFAULT_THUMBLIB_IMPLEMENTATION;
    ...

As you can see in the comments, your options are either gd or imagick. If you wish to use the imagick implementation (when it becomes available), simply change this value to imagick. Make sure you change the constant definition, and leave the class itself alone (not that you would really screw things up, this just keeps things cleaner ;)

You can also change the location of the plugins folder if you want by changing the defines at the top of this file appropriately.

Clone this wiki locally