themes and generation of 'pretty' thumbnails? This can be a performance
hit on some installations but is required for the generation of all but the
most basic image thumbnails." required="false">false</configboolean>
+ <configboolean name="squaremini" desc="Should Ansel generate square
+ thumbnails for mini images? Doing so is recommended as this gives a cleaner
+ look to views. For those that prefer the look of the older mini images that
+ Ansel generated, uncheck this option">true</configboolean>
+ <configboolean name="smartcrop" desc="Should Ansel use a SmartCrop algorithm
+ if available when generating mini or square thumbnails? This gives a better
+ change that the crop will contain an interesting part of the image, but will
+ increase CPU usage during image generation."></configboolean>
<configstring name="num_uploads" desc="How many photos should a user be
allowed to upload at once?">5</configstring>
<configstring name="font" required="false" desc="What font would you like
/**
* ImageGenerator to create the mini view.
*
+ * Copyright 2001-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @package Ansel
*/
*/
protected function _create()
{
- $generator = Ansel_ImageGenerator::factory('SquareThumb', array('width' => min(50, $this->_dimensions['width']),
- 'height' => min(50, $this->_dimensions['height']),
- 'image' => $this->_image,
- 'style' => $this->_params['style']));
- return $generator->create();
+ if ($GLOBALS['conf']['image']['squaremini']) {
+ $generator = Ansel_ImageGenerator::factory('SquareThumb', array('width' => min(50, $this->_dimensions['width']),
+ 'height' => min(50, $this->_dimensions['height']),
+ 'image' => $this->_image,
+ 'style' => $this->_params['style']));
+ return $generator->create();
+ } else {
+ $this->_image->resize(min(50, $this->_dimensions['width']),
+ min(50, $this->_dimensions['height']),
+ true);
+ if ($GLOBALS['conf']['thumbnail']['unsharp'] && Ansel::isAvailable('Unsharpmask')) {
+ try {
+ $this->_image->addEffect('Unsharpmask',
+ array('radius' => $GLOBALS['conf']['thumbnail']['radius'],
+ 'threshold' => $GLOBALS['conf']['thumbnail']['threshold'],
+ 'amount' => $GLOBALS['conf']['thumbnail']['amount']));
+ $this->_image->applyEffects();
+ } catch (Horde_Image_Exception $e) {
+ throw new Ansel_Exception($e);
+ }
+ }
+
+ return $this->_image->getHordeImage();
+ }
}
}
}
// Use smartcrop algorithm if we have it, otherwise a plain center crop.
- if (Ansel::isAvailable('SmartCrop')) {
+ if (Ansel::isAvailable('SmartCrop') && $GLOBALS['conf']['image']['smartcrop']) {
$this->_image->addEffect('SmartCrop', array('width' => $size, 'height' => $size));
} else {
$this->_image->addEffect('CenterCrop', array('width' => $size, 'height' => $size));