protected function exec($program, $params, $passthru = false)
	{
		//  Determine the path
		$this->im_path = realpath($this->config['imagemagick_dir'].$program);
		if ( ! $this->im_path)
		{
			$this->im_path = realpath($this->config['imagemagick_dir'].$program.'.exe');
		}
		if ( ! $this->im_path)
		{
			throw new \RuntimeException("imagemagick executables not found in ".$this->config['imagemagick_dir']);
		}

		$command = $this->im_path." ".$params;
		$this->debug("Running command: <code>$command</code>");
		$code = 0;
		$output = null;

		$passthru ? passthru($command) : exec($command, $output, $code);

		if ($code != 0)
		{
			throw new \FuelException("imagemagick failed to edit the image. Returned with $code.<br /><br />Command:\n <code>$command</code>");
		}

		return $output;
	}