*sigh*
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 17 Feb 2010 01:06:29 +0000 (20:06 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 17 Feb 2010 01:06:29 +0000 (20:06 -0500)
ansel/lib/ImageView/PolaroidStack.php [new file with mode: 0644]

diff --git a/ansel/lib/ImageView/PolaroidStack.php b/ansel/lib/ImageView/PolaroidStack.php
new file mode 100644 (file)
index 0000000..b2b2ddb
--- /dev/null
@@ -0,0 +1,44 @@
+<?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) {
+            return false;
+        }
+
+        return $baseImg;
+    }
+
+}