case 'editimage':
case 'cropedit':
case 'resizeedit':
- $imageview_url = Ansel::getUrlFor('view', array_merge(
+ $ImageGenerator_url = Ansel::getUrlFor('view', array_merge(
array('gallery' => $gallery_id,
'image' => $image_id,
'view' => 'Image',
'horde.error');
/* Return to the image view. */
- header('Location: ' . $imageview_url);
+ header('Location: ' . $ImageGenerator_url);
exit;
}
// Don't already have one, must generate it.
$params = array('gallery' => $this, 'style' => $gal_style);
try {
- $iview = Ansel_ImageView::factory($gal_style['default_galleryimage_type'], $params);
+ $iview = Ansel_ImageGenerator::factory($gal_style['default_galleryimage_type'], $params);
$img = $iview->create();
// Note the gallery_id is negative for generated stacks
// Manually convert the charset since we're not going through save()
// @TODO: Look at this usage - maybe each app's share object should
// have this method or just keep it public?
- $data = $this->getshareOb()->toDriverChaset(array($driver_key => $value));
+ $data = $this->getshareOb()->toDriverCharset(array($driver_key => $value));
$query = $db->prepare('UPDATE ' . $this->getShareOb()->getTable() . ' SET ' . $driver_key . ' = ? WHERE share_id = ?', null, MDB2_PREPARE_MANIP);
if ($GLOBALS['conf']['ansel_cache']['usecache']) {
$GLOBALS['injector']->getInstance('Horde_Cache')->expire('Ansel_Gallery' . $this->id);
}
try {
- $iview = Ansel_ImageView::factory($viewType, array('image' => $this, 'style' => $style));
+ $iview = Ansel_ImageGenerator::factory($viewType, array('image' => $this, 'style' => $style));
} catch (Ansel_Exception $e) {
// It could be we don't support the requested effect, try
// ansel_default before giving up.
if ($view == 'prettythumb') {
// If we still fail, the exception gets thrown up the chain.
- $iview = Ansel_ImageView::factory('Thumb', array('image' => $this, 'style' => 'ansel_default'));
+ $iview = Ansel_ImageGenerator::factory('Thumb', array('image' => $this, 'style' => 'ansel_default'));
} else {
// If it wasn't a prettythumb, then something else must be wrong
throw $e;
}
}
- /* Create the ImageView */
+ /* Create the ImageGenerator */
$iview->create();
- /* Cache the data from the new imageview */
+ /* Cache the data from the new ImageGenerator */
try {
$this->_data[$vHash] = $this->_image->raw();
} catch (Horde_Image_Exception $e) {
--- /dev/null
+<?php
+/**
+ * Class to abstract the creation of various image views.
+ *
+ * Copyright 2007-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.
+ *
+ * Copyright 2007-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
+ */
+class Ansel_ImageGenerator
+{
+ /**
+ * Ansel_Image object that this view is created from.
+ *
+ * @var Ansel_Image
+ */
+ protected $_image = null;
+
+ /**
+ * Parameters for this view
+ *
+ * @var array
+ */
+ protected $_params = array();
+
+ /**
+ * Image dimensions
+ *
+ * @var array
+ */
+ protected $_dimensions = array();
+
+ /**
+ * Cache the style information array
+ *
+ * @var array
+ */
+ protected $_style = array();
+
+ /**
+ * Array of required, supported features for this ImageGenerator to work
+ *
+ * @var array
+ */
+ public $need = array();
+
+ /**
+ * Const'r
+ *
+ * @return Horde_ImageGenerator
+ */
+ public function __construct($params)
+ {
+ $this->_params = $params;
+ if (!empty($params['image'])) {
+ $this->_image = $params['image'];
+ }
+ $this->_style = $params['style'];
+ }
+
+ /**
+ * Create and cache the view.
+ *
+ * @return mixed Views used as gallery key images return Horde_Image,
+ * other views return boolean
+ */
+ public function create()
+ {
+ if (!empty($this->_image)) {
+ // Use Horde_Image since we don't know at this point which
+ // view we have loaded.
+ $img = $this->_image->getHordeImage();
+ $this->_dimensions = $img->getDimensions();
+ }
+
+ return $this->_create();
+ }
+
+ /**
+ * Horde_ImageGenerator factory
+ *
+ * @param string $type The type of concrete instance to return.
+ * @param array $params Additional parameters needed for the instance.
+ *
+ * @return Ansel_ImageGenerator
+ * @throws Ansel_Exception
+ */
+ function factory($type, $params = array())
+ {
+ $type = basename($type);
+ $class = 'Ansel_ImageGenerator_' . $type;
+ if (!class_exists($class)) {
+ include dirname(__FILE__) . '/ImageGenerator/' . $type . '.php';
+ }
+ if (class_exists($class)) {
+ $view = new $class($params);
+ // Check that the image object supports what we need for the
+ // requested effect.
+ foreach ($view->need as $need) {
+ if (!Ansel::isAvailable($need)) {
+ Horde::logMessage($err, 'ERR');
+ throw new Ansel_Exception(_("This install does not support the %s feature. Please contact your administrator."), $need);
+ }
+ }
+ return $view;
+ } else {
+ Horde::logMessage($err, 'ERR');
+ throw new Ansel_Exception(sprintf(_("Unable to load the definition of %s."), $class));
+ }
+ }
+
+ /**
+ * Utility function to make every effort to find a subgallery that
+ * contains images.
+ *
+ * @param Ansel_Gallery $parent The gallery to start looking in
+ *
+ * @return Ansel_Gallery Gallery that has images, or the original $parent
+ */
+ protected function _getGalleryWithImages($parent)
+ {
+ $galleries = $GLOBALS['injector']
+ ->getInstance('Ansel_Storage')
+ ->getScope()
+ ->listGalleries(array('parent' => $parent, 'allLevels' => false));
+
+ foreach ($galleries as $gallery) {
+ if ($gallery->countImages()) {
+ return $gallery;
+ }
+ $result = $this->_getGalleryWithImages($gallery);
+ if ($result->countImages()) {
+ return $result;
+ }
+ }
+
+ return $parent;
+ }
+
+ /**
+ * Utility function to return an array of Horde_Images to use in building a
+ * polaroid stack. Returns a random set of 5 images from the gallery, or the
+ * explicitly set default image plus 4 others.
+ *
+ * @return array of Horde_Images
+ */
+ protected function _getStackImages()
+ {
+ $images = array();
+ $gallery = $this->_params['gallery'];
+
+ // Make sure we have images.
+ if (!$gallery->countImages() && $gallery->hasSubGalleries()) {
+ $gallery = $this->_getGalleryWithImages($gallery);
+ }
+
+ $cnt = min(5, $gallery->countImages());
+ $default = $gallery->get('default');
+ if (!empty($default) && $default > 0) {
+ try {
+ $img = $gallery->getImage($default);
+ $img->load('screen');
+ $images[] = $img->getHordeImage();
+ $cnt--;
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
+ }
+
+ for ($i = 0; $i < $cnt; $i++) {
+ $rnd = mt_rand(0, $cnt);
+ try {
+ $temp = $gallery->getImages($rnd, 1);
+ $aimg = array_shift($temp);
+ $aimg->load('screen');
+ $images[] = $aimg->getHordeImage();
+ } catch (Exception $e) {
+ Horde::logMessage($e, 'ERR');
+ }
+ }
+
+ // Reverse the array to ensure the requested default image
+ // is the last in the array (so it will appear on the top of
+ // the stack.
+ return array_reverse($images);
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the mini view.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_Mini extends Ansel_ImageGenerator
+{
+ /**
+ *
+ * @return Horde_Image
+ */
+ protected function _create()
+ {
+ $this->_image->resize(min(50, $this->_dimensions['width']),
+ min(50, $this->_dimensions['height']),
+ true);
+
+ return $this->_image->getHordeImage();
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the gallery image stacks.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_PlainStack extends Ansel_ImageGenerator
+{
+ public $need = array('PhotoStack');
+
+ /**
+ *
+ * @return Horde_Image
+ */
+ protected function _create()
+ {
+ $imgobjs = $this->_getStackImages();
+ $style = $this->_params['style'];
+ $params = array('width' => 100,
+ 'height' => 100,
+ 'background' => $style['background']);
+
+ $baseImg = Ansel::getImageObject($params);
+ try {
+ $baseImg->addEffect(
+ 'PhotoStack',
+ array('images' => $imgobjs,
+ 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
+ 'padding' => 0,
+ 'background' => $style['background'],
+ 'type' => 'plain'));
+
+ $baseImg->applyEffects();
+ $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
+ $GLOBALS['conf']['thumbnail']['height']);
+ } catch (Horde_Image_Exception $e) {
+ throw new Ansel_Exception($e);
+ }
+
+ return $baseImg;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the gallery polaroid stacks.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_PolaroidStack extends Ansel_ImageGenerator
+{
+ public $need = array('PhotoStack');
+
+ /**
+ *
+ * @return Horde_Image
+ */
+ protected function _create()
+ {
+ $imgobjs = $this->_getStackImages();
+ $style = $this->_params['style'];
+ $params = array('width' => 100,
+ 'height' => 100,
+ 'background' => $style['background']);
+
+ $baseImg = Ansel::getImageObject($params);
+ try {
+ $baseImg->addEffect(
+ 'PhotoStack',
+ array('images' => $imgobjs,
+ 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
+ 'padding' => 10,
+ 'background' => $style['background'],
+ 'type' => 'polaroid'));
+ $baseImg->applyEffects();
+ $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
+ $GLOBALS['conf']['thumbnail']['height']);
+
+ } catch (Horde_Image_Exception $e) {
+ throw new Ansel_Exception($e);
+ }
+
+ return $baseImg;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the shadowsharpthumb view (sharp corners, shadowed)
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_PolaroidThumb extends Ansel_ImageGenerator
+{
+ public $need = array('PolaroidImage');
+
+ /**
+ *
+ * @return Horde_Image
+ */
+ protected function _create()
+ {
+ $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
+ min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
+ true);
+
+ /* Don't bother with these effects for a custom gallery default image
+ (which will have a negative gallery_id). */
+ if ($this->_image->gallery > 0) {
+ if (is_null($this->_style)) {
+ $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery);
+ $styleDef = $gal->getStyle();
+ } else {
+ $styleDef = Ansel::getStyleDefinition($this->_style);
+ }
+ try {
+ $this->_image->addEffect('PolaroidImage',
+ array('background' => $styleDef['background'],
+ 'padding' => 5));
+
+ $this->_image->applyEffects();
+ } catch (Horde_Image_Exception $e) {
+ throw new Ansel_Exception($e);
+ }
+
+ return true;
+ }
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the prettythumb view (rounded, shadowed thumbnails).
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_PrettyThumb extends Ansel_ImageGenerator
+{
+ public $need = array('RoundCorners', 'DropShadow');
+
+ /**
+ *
+ * @return Horde_Image
+ */
+ protected function _create()
+ {
+ $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
+ min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
+ true);
+
+ /* Don't bother with these effects for a stack image
+ * (which will have a negative gallery_id). */
+ if ($this->_image->gallery > 0) {
+ if (is_null($this->_style)) {
+ $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery);
+ $styleDef = $gal->getStyle();
+ } else {
+ $styleDef = Ansel::getStyleDefinition($this->_style);
+ }
+
+ try {
+ /* Apply the effects - continue on error, but be sure to log */
+ $this->_image->addEffect('RoundCorners', array('border' => 2,
+ 'bordercolor' => '#333'));
+
+ $this->_image->addEffect('DropShadow', array('background' => $styleDef['background'],
+ 'padding' => 5,
+ 'distance' => 5,
+ 'fade' => 3));
+ } catch (Horde_Image_Exception $e) {
+ throw new Ansel_Exception($e);
+ }
+ $this->_image->applyEffects();
+
+ return $this->_image->getHordeImage();
+ }
+ }
+
+}
--- /dev/null
+ <?php
+/**
+ * ImageGenerator to create the gallery image stacks.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ *
+ */
+class Ansel_ImageGenerator_RoundedStack extends Ansel_ImageGenerator
+ {
+ public $need = array('PhotoStack');
+
+ /**
+ *
+ * @return Horde_Image
+ */
+ protected function _create()
+ {
+ $imgobjs = $this->_getStackImages();
+ $style = $this->_params['style'];
+ $params = array('width' => 100,
+ 'height' => 100,
+ 'background' => $style['background']);
+
+ $baseImg = Ansel::getImageObject($params);
+
+ try {
+ $baseImg->addEffect(
+ 'PhotoStack',
+ array('images' => $imgobjs,
+ 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
+ 'padding' => 0,
+ 'background' => $style['background'],
+ 'type' => 'rounded'));
+
+ $baseImg->applyEffects();
+ $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
+ $GLOBALS['conf']['thumbnail']['height']);
+ } catch (Horde_Image_Exception $e) {
+ throw new Ansel_Exception($e);
+ }
+
+ return $baseImg;
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the screen view - image sized for slideshow view.
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_Screen extends Ansel_ImageGenerator
+{
+ /**
+ *
+ * @return boolean
+ */
+ protected function _create()
+ {
+ $this->_image->resize(min($GLOBALS['conf']['screen']['width'], $this->_dimensions['width']),
+ min($GLOBALS['conf']['screen']['height'], $this->_dimensions['height']),
+ true);
+
+ return $this->_image->getHordeImage();
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the shadowsharpthumb view (sharp corners, shadowed)
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_ShadowSharpThumb extends Ansel_ImageGenerator
+{
+ public $need = array('DropShadow');
+
+ /**
+ *
+ * @return boolean
+ */
+ protected function _create()
+ {
+ $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
+ min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
+ true);
+
+ /* Don't bother with these effects for a stack image
+ * (which will have a negative gallery_id). */
+ if ($this->_image->gallery > 0) {
+ if (is_null($this->_style)) {
+ $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery);
+ $styleDef = $gal->getStyle();
+ } else {
+ $styleDef = Ansel::getStyleDefinition($this->_style);
+ }
+
+ try {
+ $this->_image->addEffect('Border', array('bordercolor' => '#333', 'borderwidth' => 1));
+ $this->_image->addEffect('DropShadow',
+ array('background' => $styleDef['background'],
+ 'padding' => 5,
+ 'distance' => 8,
+ 'fade' => 2));
+ $this->_image->applyEffects();
+ } catch (Horde_Image_Exception $e) {
+ throw new Ansel_Exception($e);
+ }
+
+ return $this->_image->getHordeImage();
+ }
+ }
+
+}
--- /dev/null
+<?php
+/**
+ * ImageGenerator to create the thumb view (plain, resized thumbnails).
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @package Ansel
+ */
+class Ansel_ImageGenerator_Thumb extends Ansel_ImageGenerator
+{
+ /**
+ *
+ * @return Horde_Image
+ */
+ protected function _create()
+ {
+ $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
+ min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
+ true);
+ return $this->_image->getHordeImage();
+ }
+
+}
+++ /dev/null
-<?php
-/**
- * Class to abstract the creation of various image views.
- *
- * Copyright 2007-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.
- *
- * Copyright 2007-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
- */
-class Ansel_ImageView
-{
- /**
- * Ansel_Image object that this view is created from.
- *
- * @var Ansel_Image
- */
- protected $_image = null;
-
- /**
- * Parameters for this view
- *
- * @var array
- */
- protected $_params = array();
-
- /**
- * Image dimensions
- *
- * @var array
- */
- protected $_dimensions = array();
-
- /**
- * Cache the style information array
- *
- * @var array
- */
- protected $_style = array();
-
- /**
- * Array of required, supported features for this ImageView to work
- *
- * @var array
- */
- public $need = array();
-
- /**
- * Const'r
- *
- * @return Horde_ImageView
- */
- public function __construct($params)
- {
- $this->_params = $params;
- if (!empty($params['image'])) {
- $this->_image = $params['image'];
- }
- $this->_style = $params['style'];
- }
-
- /**
- * Create and cache the view.
- *
- * @return mixed Views used as gallery key images return Horde_Image,
- * other views return boolean
- */
- public function create()
- {
- if (!empty($this->_image)) {
- // Use Horde_Image since we don't know at this point which
- // view we have loaded.
- $img = $this->_image->getHordeImage();
- $this->_dimensions = $img->getDimensions();
- }
-
- return $this->_create();
- }
-
- /**
- * Horde_ImageView factory
- *
- * @param string $type The type of concrete instance to return.
- * @param array $params Additional parameters needed for the instance.
- *
- * @return Ansel_ImageView
- * @throws Ansel_Exception
- */
- function factory($type, $params = array())
- {
- $type = basename($type);
- $class = 'Ansel_ImageView_' . $type;
- if (!class_exists($class)) {
- include dirname(__FILE__) . '/ImageView/' . $type . '.php';
- }
- if (class_exists($class)) {
- $view = new $class($params);
- // Check that the image object supports what we need for the
- // requested effect.
- foreach ($view->need as $need) {
- if (!Ansel::isAvailable($need)) {
- Horde::logMessage($err, 'ERR');
- throw new Ansel_Exception(_("This install does not support the %s feature. Please contact your administrator."), $need);
- }
- }
- return $view;
- } else {
- Horde::logMessage($err, 'ERR');
- throw new Ansel_Exception(sprintf(_("Unable to load the definition of %s."), $class));
- }
- }
-
- /**
- * Utility function to make every effort to find a subgallery that
- * contains images.
- *
- * @param Ansel_Gallery $parent The gallery to start looking in
- *
- * @return Ansel_Gallery Gallery that has images, or the original $parent
- */
- protected function _getGalleryWithImages($parent)
- {
- $galleries = $GLOBALS['injector']
- ->getInstance('Ansel_Storage')
- ->getScope()
- ->listGalleries(array('parent' => $parent, 'allLevels' => false));
-
- foreach ($galleries as $gallery) {
- if ($gallery->countImages()) {
- return $gallery;
- }
- $result = $this->_getGalleryWithImages($gallery);
- if ($result->countImages()) {
- return $result;
- }
- }
-
- return $parent;
- }
-
- /**
- * Utility function to return an array of Horde_Images to use in building a
- * polaroid stack. Returns a random set of 5 images from the gallery, or the
- * explicitly set default image plus 4 others.
- *
- * @return array of Horde_Images
- */
- protected function _getStackImages()
- {
- $images = array();
- $gallery = $this->_params['gallery'];
-
- // Make sure we have images.
- if (!$gallery->countImages() && $gallery->hasSubGalleries()) {
- $gallery = $this->_getGalleryWithImages($gallery);
- }
-
- $cnt = min(5, $gallery->countImages());
- $default = $gallery->get('default');
- if (!empty($default) && $default > 0) {
- try {
- $img = $gallery->getImage($default);
- $img->load('screen');
- $images[] = $img->getHordeImage();
- $cnt--;
- } catch (Exception $e) {
- Horde::logMessage($e, 'ERR');
- }
- }
-
- for ($i = 0; $i < $cnt; $i++) {
- $rnd = mt_rand(0, $cnt);
- try {
- $temp = $gallery->getImages($rnd, 1);
- $aimg = array_shift($temp);
- $aimg->load('screen');
- $images[] = $aimg->getHordeImage();
- } catch (Exception $e) {
- Horde::logMessage($e, 'ERR');
- }
- }
-
- // Reverse the array to ensure the requested default image
- // is the last in the array (so it will appear on the top of
- // the stack.
- return array_reverse($images);
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the mini view.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_Mini extends Ansel_ImageView
-{
- /**
- *
- * @return Horde_Image
- */
- protected function _create()
- {
- $this->_image->resize(min(50, $this->_dimensions['width']),
- min(50, $this->_dimensions['height']),
- true);
-
- return $this->_image->getHordeImage();
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the gallery image stacks.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_PlainStack extends Ansel_ImageView
-{
- public $need = array('PhotoStack');
-
- /**
- *
- * @return Horde_Image
- */
- protected function _create()
- {
- $imgobjs = $this->_getStackImages();
- $style = $this->_params['style'];
- $params = array('width' => 100,
- 'height' => 100,
- 'background' => $style['background']);
-
- $baseImg = Ansel::getImageObject($params);
- try {
- $baseImg->addEffect(
- 'PhotoStack',
- array('images' => $imgobjs,
- 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
- 'padding' => 0,
- 'background' => $style['background'],
- 'type' => 'plain'));
-
- $baseImg->applyEffects();
- $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
- $GLOBALS['conf']['thumbnail']['height']);
- } catch (Horde_Image_Exception $e) {
- throw new Ansel_Exception($e);
- }
-
- return $baseImg;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the gallery polaroid stacks.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_PolaroidStack extends Ansel_ImageView
-{
- public $need = array('PhotoStack');
-
- /**
- *
- * @return Horde_Image
- */
- protected function _create()
- {
- $imgobjs = $this->_getStackImages();
- $style = $this->_params['style'];
- $params = array('width' => 100,
- 'height' => 100,
- 'background' => $style['background']);
-
- $baseImg = Ansel::getImageObject($params);
- try {
- $baseImg->addEffect(
- 'PhotoStack',
- array('images' => $imgobjs,
- 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
- 'padding' => 10,
- 'background' => $style['background'],
- 'type' => 'polaroid'));
- $baseImg->applyEffects();
- $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
- $GLOBALS['conf']['thumbnail']['height']);
-
- } catch (Horde_Image_Exception $e) {
- throw new Ansel_Exception($e);
- }
-
- return $baseImg;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the shadowsharpthumb view (sharp corners, shadowed)
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_PolaroidThumb extends Ansel_ImageView
-{
- public $need = array('PolaroidImage');
-
- /**
- *
- * @return Horde_Image
- */
- protected function _create()
- {
- $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
- min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
- true);
-
- /* Don't bother with these effects for a custom gallery default image
- (which will have a negative gallery_id). */
- if ($this->_image->gallery > 0) {
- if (is_null($this->_style)) {
- $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery);
- $styleDef = $gal->getStyle();
- } else {
- $styleDef = Ansel::getStyleDefinition($this->_style);
- }
- try {
- $this->_image->addEffect('PolaroidImage',
- array('background' => $styleDef['background'],
- 'padding' => 5));
-
- $this->_image->applyEffects();
- } catch (Horde_Image_Exception $e) {
- throw new Ansel_Exception($e);
- }
-
- return true;
- }
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the prettythumb view (rounded, shadowed thumbnails).
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_PrettyThumb extends Ansel_ImageView
-{
- public $need = array('RoundCorners', 'DropShadow');
-
- /**
- *
- * @return Horde_Image
- */
- protected function _create()
- {
- $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
- min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
- true);
-
- /* Don't bother with these effects for a stack image
- * (which will have a negative gallery_id). */
- if ($this->_image->gallery > 0) {
- if (is_null($this->_style)) {
- $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery);
- $styleDef = $gal->getStyle();
- } else {
- $styleDef = Ansel::getStyleDefinition($this->_style);
- }
-
- try {
- /* Apply the effects - continue on error, but be sure to log */
- $this->_image->addEffect('RoundCorners', array('border' => 2,
- 'bordercolor' => '#333'));
-
- $this->_image->addEffect('DropShadow', array('background' => $styleDef['background'],
- 'padding' => 5,
- 'distance' => 5,
- 'fade' => 3));
- } catch (Horde_Image_Exception $e) {
- throw new Ansel_Exception($e);
- }
- $this->_image->applyEffects();
-
- return $this->_image->getHordeImage();
- }
- }
-
-}
+++ /dev/null
- <?php
-/**
- * ImageView to create the gallery image stacks.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- *
- */
-class Ansel_ImageView_RoundedStack extends Ansel_ImageView
- {
- public $need = array('PhotoStack');
-
- /**
- *
- * @return Horde_Image
- */
- protected function _create()
- {
- $imgobjs = $this->_getStackImages();
- $style = $this->_params['style'];
- $params = array('width' => 100,
- 'height' => 100,
- 'background' => $style['background']);
-
- $baseImg = Ansel::getImageObject($params);
-
- try {
- $baseImg->addEffect(
- 'PhotoStack',
- array('images' => $imgobjs,
- 'resize_height' => $GLOBALS['conf']['thumbnail']['height'],
- 'padding' => 0,
- 'background' => $style['background'],
- 'type' => 'rounded'));
-
- $baseImg->applyEffects();
- $baseImg->resize($GLOBALS['conf']['thumbnail']['width'],
- $GLOBALS['conf']['thumbnail']['height']);
- } catch (Horde_Image_Exception $e) {
- throw new Ansel_Exception($e);
- }
-
- return $baseImg;
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the screen view - image sized for slideshow view.
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_Screen extends Ansel_ImageView
-{
- /**
- *
- * @return boolean
- */
- protected function _create()
- {
- $this->_image->resize(min($GLOBALS['conf']['screen']['width'], $this->_dimensions['width']),
- min($GLOBALS['conf']['screen']['height'], $this->_dimensions['height']),
- true);
-
- return $this->_image->getHordeImage();
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the shadowsharpthumb view (sharp corners, shadowed)
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_ShadowSharpThumb extends Ansel_ImageView
-{
- public $need = array('DropShadow');
-
- /**
- *
- * @return boolean
- */
- protected function _create()
- {
- $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
- min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
- true);
-
- /* Don't bother with these effects for a stack image
- * (which will have a negative gallery_id). */
- if ($this->_image->gallery > 0) {
- if (is_null($this->_style)) {
- $gal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope()->getGallery($this->_image->gallery);
- $styleDef = $gal->getStyle();
- } else {
- $styleDef = Ansel::getStyleDefinition($this->_style);
- }
-
- try {
- $this->_image->addEffect('Border', array('bordercolor' => '#333', 'borderwidth' => 1));
- $this->_image->addEffect('DropShadow',
- array('background' => $styleDef['background'],
- 'padding' => 5,
- 'distance' => 8,
- 'fade' => 2));
- $this->_image->applyEffects();
- } catch (Horde_Image_Exception $e) {
- throw new Ansel_Exception($e);
- }
-
- return $this->_image->getHordeImage();
- }
- }
-
-}
+++ /dev/null
-<?php
-/**
- * ImageView to create the thumb view (plain, resized thumbnails).
- *
- * @author Michael J. Rubinsky <mrubinsk@horde.org>
- * @package Ansel
- */
-class Ansel_ImageView_Thumb extends Ansel_ImageView
-{
- /**
- *
- * @return Horde_Image
- */
- protected function _create()
- {
- $this->_image->resize(min($GLOBALS['conf']['thumbnail']['width'], $this->_dimensions['width']),
- min($GLOBALS['conf']['thumbnail']['height'], $this->_dimensions['height']),
- true);
- return $this->_image->getHordeImage();
- }
-
-}
* full - Should a full URL be generated? [false]
* from - Starting image count [0]
* count - The number of images to include (starting at from) [0]
- * image_view - The type of ImageView to obtain the src url for. [screen]
+ * image_view - The type of ImageGenerator to obtain the src url for. [screen]
* view_links - Should the JSON include links to the Image and/or Gallery View? [false]
* perpage - Number of images per page [from user prefs]
* </pre>
$image_src = Ansel::getImageUrl($image_id, 'full');
echo $galleryurl->link() . Horde::img('galleries.png') . ' ' . _("Back to gallery") . '</a> ';
-echo $imageview_url->link() . Horde::img('galleries.png') . ' ' . _("Cancel") . '</a> ';
+echo $ImageGenerator_url->link() . Horde::img('galleries.png') . ' ' . _("Cancel") . '</a> ';
if (Ansel::isAvailable('rotate')) {
echo $imageurl->copy()->add('actionID', 'previewrotate270')->link() . Horde::img('image/rotate-270.png') . ' ' . _("Rotate Left") . '</a> ';
$image_src = Ansel::getImageUrl($image_id, 'screen');
echo $galleryurl->link() . Horde::img('galleries.png') . ' ' . _("Back to gallery") . '</a> ';
-echo $imageview_url->link() . Horde::img('galleries.png') . ' ' . _("Cancel") . '</a> ';
+echo $ImageGenerator_url->link() . Horde::img('galleries.png') . ' ' . _("Cancel") . '</a> ';
if (Ansel::isAvailable('rotate')) {
echo $imageurl->copy()->add('actionID', 'previewrotate270')->link() . Horde::img('image/rotate-270.png') . ' ' . _("Rotate Left") . '</a> ';
$image_src = Ansel::getImageUrl($image_id, 'full');
echo $galleryurl->link() . Horde::img('galleries.png') . ' ' . _("Back to gallery") . '</a> ';
-echo $imageview_url->link() . Horde::img('galleries.png') . ' ' . _("Cancel") . '</a> ';
+echo $ImageGenerator_url->link() . Horde::img('galleries.png') . ' ' . _("Cancel") . '</a> ';
if (Ansel::isAvailable('rotate')) {
echo $imageurl->copy()->add('actionID', 'previewrotate270')->link() . Horde::img('image/rotate-270.png') . ' ' . _("Rotate Left") . '</a> ';