Building thumbnails dynamicly in PHP

One problem Ive always hated was creating lots of thumbnails for images. So instead I created a PHP wrapper for the command line imagemagick tools.

This script requires Cana_Thumb which you can get on github:

https://github.com/arzynik/cana/blob/master/lib/Cana/Thumb.php

class Cana_Thumb { private $_path; private $_cache; private $_watermark; private $_img; private $_im;

public function __construct($params = array()) {
  $this->setOptions($params);

  if (file_exists('/usr/local/bin/convert')) {
    $this->_im = '/usr/local/bin/convert';
  } elseif(file_exists('/usr/bin/convert')) {
    $this->_im = '/usr/bin/convert';
  } elseif(file_exists('/opt/local/bin/convert')) {
    $this->_im = '/opt/local/bin/convert';
  } else {
    throw new Exception('Could not find imagemagick');
  }

  if ($this->_im && isset($params['img'])) {
    $this->writeThumb($params['img']);
  }
}

}