[limb-svn] r6960 - in 3.x/trunk/limb/imagekit: src src/gd src/gd/filters src/im tests/cases tests/cases/gd tests/cases/gd/filters tests/cases/im tests/var tests/var/filters

svn at limb-project.com svn at limb-project.com
Sun Apr 27 00:45:33 MSD 2008


Author: cmz
Date: 2008-04-27 00:45:33 +0400 (Sun, 27 Apr 2008)
New Revision: 6960
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6960

Added:
   3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php
   3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdCropImageFilterTest.class.php
   3.x/trunk/limb/imagekit/tests/var/filters/
   3.x/trunk/limb/imagekit/tests/var/filters/lmbGdTestImageFilter.class.php
   3.x/trunk/limb/imagekit/tests/var/filters/lmbImTestImageFilter.class.php
Modified:
   3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php
   3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php
   3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php
   3.x/trunk/limb/imagekit/src/lmbAbstractImageConvertor.class.php
   3.x/trunk/limb/imagekit/src/lmbImageKit.class.php
   3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdWaterMarkImageFilterTest.class.php
   3.x/trunk/limb/imagekit/tests/cases/gd/lmbGdImageConvertorTest.class.php
   3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php
   3.x/trunk/limb/imagekit/tests/cases/lmbImageKitTest.class.php
Log:
-- added gd filter 'crop'
-- added parameters 'xcenter' and 'ycenter' to gd filter 'watermark'
-- image convertors scan more than one directories now

Added: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php	                        (rev 0)
+++ 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -0,0 +1,68 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright  Copyright &copy; 2004-2008 BIT(http://bit-creative.com)
+ * @license    LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+
+/**
+ * Crop image filter
+ * @package imagekit
+ * @version $Id$
+ */
+class lmbGdCropImageFilter extends lmbAbstractImageFilter
+{
+  function apply(lmbAbstractImageContainer $container)
+  {
+    list($x, $y, $width, $height) = $this->calculateCropArea($container->getWidth(), $container->getHeight());
+    $im = $container->isPallete() ? imagecreate($width, $height) : imagecreatetruecolor($width, $height);
+    imagecopy($im, $container->getResource(), 0, 0, $x, $y, $width, $height);
+    $container->replaceResource($im);
+  }
+  
+  function calculateCropArea($image_width, $image_height)
+  {
+    $width = $this->getWidth();
+    $height = $this->getHeight();
+    if($width === null)
+      $width = $image_width;
+    if($height === null)
+      $height = $image_height;
+      
+    $x = $this->getX();
+    $y = $this->getY();
+    
+    if($x + $width > $image_width)
+      $width -= $x + $width - $image_width;
+    if($y + $height > $image_height)
+      $height -= $y + $height - $image_height;
+      
+    return array($x, $y, $width, $height);
+  }
+
+  function getWidth()
+  {
+  	return $this->getParam('width');
+  }
+
+  function getHeight()
+  {
+    return $this->getParam('height');
+  }
+  
+  function getX()
+  {
+    return $this->getParam('x', 0);
+  }
+
+  function getY()
+  {
+    return $this->getParam('y', 0);
+  }
+
+}
+?>


Property changes on: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -22,19 +22,44 @@
     $width = $container->getWidth();
     $height = $container->getHeight();
     $wm_cont = new lmbGdImageContainer();
-    $wm_cont->load($this->getWaterMark());
-    list($x, $y) = $this->calcPosition($this->getX(), $this->getY(), $width, $height);
+    $wm_cont->load($this->getWaterMark());
+    $wm_width = $this->getXCenter() ? $wm_cont->getWidth() : false;
+    $wm_height = $this->getYCenter() ? $wm_cont->getHeight() : false;
+    list($x, $y) = $this->calcPosition($this->getX(), $this->getY(), $width, $height, $wm_width, $wm_height);
     imagecopymerge($container->getResource(), $wm_cont->getResource(), $x, $y, 0, 0, $wm_cont->getWidth(), $wm_cont->getHeight(), 100 - $this->getOpacity());
   }
-
-  function calcPosition($x, $y, $width, $height)
-  {
-  	if($x >= 0 && $y >= 0)
-      return array($x, $y);
-    if($x < 0)
-      $x += $width;
-    if($y < 0)
-      $y += $height;
+
+  /**
+   * Calculate position of a watermark
+   *
+   * @param int $x x position of watermark
+   * @param int $y y position of watermark
+   * @param int $width width of a marked image
+   * @param int $height height of a marked image
+   * @param mixed $wm_width width of a watermark
+   * @param mixed $wm_height height of a watermark 
+   * @return array (x, y)
+   */
+  function calcPosition($x, $y, $width, $height, $wm_width = false, $wm_height = false)
+  {
+    if($wm_width !== false)
+    {
+      $x += round(($width - $wm_width) / 2);
+    }
+    else
+    {
+      if($x < 0)
+        $x += $width;      
+    }
+    if($wm_height !== false)
+    {
+      $y += round(($height - $wm_height) / 2);
+    }
+    else
+    {
+      if($y < 0)
+        $y += $height;      
+    }
     return array($x, $y);
   }
 
@@ -56,6 +81,16 @@
   function getOpacity()
   {
     return $this->getParam('opacity', 0);
-  }
+  }
+  
+  function getXCenter()
+  {
+    return $this->getParam('xcenter', false);
+  }
+    
+  function getYCenter()
+  {
+    return $this->getParam('ycenter', false);
+  }
 }
 ?>
\ No newline at end of file

Modified: 3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -21,15 +21,19 @@
 class lmbGdImageConvertor extends lmbAbstractImageConvertor
 {
 
-  function __construct()
+  function __construct($params = array())
   {
     if (!function_exists('gd_info'))
-      throw new lmbImageLibraryNotInstalledException('gd');
+      throw new lmbImageLibraryNotInstalledException('gd');
+      
+    if(!isset($params['filters_scan_dirs']))
+      $params['filters_scan_dirs'] = dirname(__FILE__).'/filters';
+    parent::__construct($params);
   }
     
   protected function createFilter($name, $params)
   {
-    $class = $this->loadFilter(dirname(__FILE__).'/filters', $name, 'Gd');
+    $class = $this->loadFilter($name, 'Gd', $params);
     return new $class($params);
   }
 

Modified: 3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -22,15 +22,19 @@
 class lmbImImageConvertor extends lmbAbstractImageConvertor
 {
   
-  function __construct()
+  function __construct($params = array())
   {
     if (!class_exists('Imagick'))
-      throw new lmbImageLibraryNotInstalledException('ImageMagick');
+      throw new lmbImageLibraryNotInstalledException('ImageMagick');
+      
+    if(!isset($params['filters_scan_dirs']))
+      $params['filters_scan_dirs'] = dirname(__FILE__).'/filters';
+    parent::__construct($params);
   }
   
   protected function createFilter($name, $params)
   {
-    $class = $this->loadFilter(dirname(__FILE__).'/filters', $name, 'Im');
+    $class = $this->loadFilter($name, 'Im');
     return new $class($params);
   }
 


Property changes on: 3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: 3.x/trunk/limb/imagekit/src/lmbAbstractImageConvertor.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/lmbAbstractImageConvertor.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/src/lmbAbstractImageConvertor.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -6,6 +6,9 @@
  * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
  * @license    LGPL http://www.gnu.org/copyleft/lesser.html
  */
+
+lmb_require('limb/fs/src/lmbFileLocationsList.class.php');
+lmb_require('limb/fs/src/lmbFileLocator.class.php');
 
 /**
  * Abstract image convertor
@@ -15,8 +18,14 @@
  */
 abstract class lmbAbstractImageConvertor
 {
-  protected $container = null;
-
+  protected $container = null;
+  protected $params;
+  
+  function __construct($params = array())
+  {    
+    $this->params = $params;
+  }
+  
   function __call($name, $args)
   {
     $params = (isset($args[0]) && is_array($args[0])) ? $args[0] : array();
@@ -28,6 +37,30 @@
     $filter = $this->createFilter($name, $params);
     $filter->apply($this->container);
     return $this;
+  }
+  
+  /**
+   * Return filter locator
+   *
+   * @return lmbFileLocator
+   */
+  protected function getFilterLocator()
+  {
+    $dirs = array();
+    if(is_array($this->params['filters_scan_dirs']))
+      $dirs = $this->params['filters_scan_dirs'];
+    else
+      $dirs['filters_scan_dirs'] = $this->params['filters_scan_dirs'];
+      
+    if(isset($this->params['add_filters_scan_dirs']))
+    {
+      if(is_array($this->params['add_filters_scan_dirs']))
+        $dirs = array_merge($dirs, $this->params['add_filters_scan_dirs']);
+      else
+        $dirs[] = $this->params['add_filters_scan_dirs'];
+    }
+    
+    return new lmbFileLocator(new lmbFileLocationsList($dirs));
   }
 
   function load($file_name, $type = '')
@@ -62,10 +95,10 @@
     return $this;
   }
 
-  protected function loadFilter($dir, $name, $prefix)
+  protected function loadFilter($name, $prefix)
   {
     $class = 'lmb'.$prefix.ucfirst($name).'ImageFilter';
-    $full_path = $dir.'/'.$class.'.class.php';
+    $full_path = $this->getFilterLocator()->locate($class.'.class.php');
     lmb_require($full_path);
     return $class;
   }

Modified: 3.x/trunk/limb/imagekit/src/lmbImageKit.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/lmbImageKit.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/src/lmbImageKit.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -14,7 +14,7 @@
 class lmbImageKit
 {
 
-  static function create($library = 'gd', $dir = '')
+  static function create($library = 'gd', $dir = '', $params = array())
   {
     if(defined('LIMB_IMAGE_LIBRARY'))
       $library = LIMB_IMAGE_LIBRARY;
@@ -28,12 +28,12 @@
 
     lmb_require($class_path);
 
-    return new $image_class_name();
+    return new $image_class_name($params);
   }
 
-  static function load($file_name, $type = '', $library = 'gd', $dir = '')
+  static function load($file_name, $type = '', $library = 'gd', $dir = '', $params = array())
   {
-  	$convertor = self::create($library, $dir);
+  	$convertor = self::create($library, $dir, $params);
     $convertor->load($file_name, $type);
     return $convertor;
   }

Added: 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdCropImageFilterTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdCropImageFilterTest.class.php	                        (rev 0)
+++ 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdCropImageFilterTest.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -0,0 +1,131 @@
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
+ * @license    LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+lmb_require('limb/imagekit/src/gd/lmbGdImageContainer.class.php');
+lmb_require('limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php');
+
+/**
+ * @package imagekit
+ * @version $Id$
+ */
+class lmbGdCropImageFilterTest extends UnitTestCase
+{
+
+  function _getInputImage()
+  {
+    return dirname(__FILE__).'/../../../var/input.jpg';
+  }
+
+  function _getInputPalleteImage()
+  {
+    return dirname(__FILE__).'/../../../var/water_mark.gif';
+  }
+
+  function _getOutputImage()
+  {
+    return dirname(__FILE__).'/../../../var/output.jpg';
+  }
+
+  function _getContainer()
+  {
+    $cont = new lmbGdImageContainer();
+    $cont->load($this->_getInputImage());
+    return $cont;
+  }
+
+  function _getPalleteContainer()
+  {
+    $cont = new lmbGdImageContainer();
+    $cont->load($this->_getInputPalleteImage());
+    return $cont;
+  }
+
+  function testTrueColorCrop()
+  {
+    $cont = $this->_getContainer();
+    $filter = new lmbGdCropImageFilter(array('width' => 50, 'height' => 70, 'x' => 10, 'y' => 20));
+
+    $filter->apply($cont);
+    $cont->save($this->_getOutputImage());
+    list($width, $height, $type) = getimagesize($this->_getOutputImage());
+    $this->assertEqual($width, 50);
+    $this->assertEqual($height, 70);    
+    $cont->load($this->_getOutputImage());
+    $this->assertFalse($cont->isPallete());
+  }
+
+  function testPalleteCrop()
+  {
+    $cont = $this->_getPalleteContainer();
+    $filter = new lmbGdCropImageFilter(array('width' => 5, 'height' => 10));
+
+    $filter->apply($cont);
+    $cont->save($this->_getOutputImage());
+    list($width, $height, $type) = getimagesize($this->_getOutputImage());
+    $this->assertEqual($width, 5);
+    $this->assertEqual($height, 10);    
+    $cont->load($this->_getOutputImage());
+    $this->assertTrue($cont->isPallete());
+  }
+  
+  function testMaxSizeRestriction()
+  {
+    $cont = $this->_getPalleteContainer();
+    $filter = new lmbGdCropImageFilter(array('width' => 100, 'height' => 100));
+
+    $filter->apply($cont);
+    $cont->save($this->_getOutputImage());
+    list($width, $height, $type) = getimagesize($this->_getOutputImage());
+    $this->assertEqual($width, 14);
+    $this->assertEqual($height, 15);    
+    $cont->load($this->_getOutputImage());
+  }
+
+  function testCropOfInternalArea()
+  {
+    $cont = $this->_getContainer();
+    $filter = new lmbGdCropImageFilter(array('x' => 10, 'y' => 20, 'width' => 40, 'height' => 50));
+
+    $filter->apply($cont);
+    $cont->save($this->_getOutputImage());
+    list($width, $height, $type) = getimagesize($this->_getOutputImage());
+    $this->assertEqual($width, 40);
+    $this->assertEqual($height, 50);    
+    $cont->load($this->_getOutputImage());
+  }
+
+  function testAutoDetectionOfSize()
+  {
+    $cont = $this->_getContainer();
+    $filter = new lmbGdCropImageFilter(array('x' => 10, 'y' => 20));
+
+    $filter->apply($cont);
+    $cont->save($this->_getOutputImage());
+    list($width, $height, $type) = getimagesize($this->_getOutputImage());
+    $this->assertEqual($width, 90);
+    $this->assertEqual($height, 117);    
+    $cont->load($this->_getOutputImage());
+  }
+
+  function testParams()
+  {
+    $filter = new lmbGdCropImageFilter(array('width' => 90, 'height' => 100, 'x' => 10, 'y' => 20));
+
+    $this->assertEqual($filter->getWidth(), 90);
+    $this->assertEqual($filter->getHeight(), 100);
+    $this->assertEqual($filter->getX(), 10);
+    $this->assertEqual($filter->getY(), 20);
+  }
+
+  function tearDown()
+  {
+    @unlink($this->_getOutputImage());
+  }
+}
+?>
\ No newline at end of file


Property changes on: 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdCropImageFilterTest.class.php
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdWaterMarkImageFilterTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdWaterMarkImageFilterTest.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdWaterMarkImageFilterTest.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -51,33 +51,47 @@
 
   function testParams()
   {
-    $filter = new lmbGdWaterMarkImageFilter(array('water_mark' => 'input.jpg', 'x' => 90, 'y' => 100, 'opacity' => 20));
+    $filter = new lmbGdWaterMarkImageFilter(array('water_mark' => 'input.jpg', 'x' => 90, 'y' => 100, 'opacity' => 20, 'xcenter' => true, 'ycenter' => true));
 
     $this->assertEqual($filter->getWaterMark(), 'input.jpg');
     $this->assertEqual($filter->getX(), 90);
     $this->assertEqual($filter->getY(), 100);
-    $this->assertEqual($filter->getOpacity(), 20);
+    $this->assertEqual($filter->getOpacity(), 20);
+    $this->assertTrue($filter->getXCenter());
+    $this->assertTrue($filter->getYCenter());
   }
 
   function testCalcPosition()
   {
     $filter = new lmbGdWaterMarkImageFilter(array());
 
-    $result = $filter->calcPosition(10, 100, 150, 250);
+    $result = $filter->calcPosition(10, 100, 150, 250, false, false);
     $this->assertEqual($result[0], 10);
     $this->assertEqual($result[1], 100);
 
-    $result = $filter->calcPosition(-10, 100, 150, 250);
+    $result = $filter->calcPosition(-10, 100, 150, 250, false, false);
     $this->assertEqual($result[0], 140);
     $this->assertEqual($result[1], 100);
 
-    $result = $filter->calcPosition(10, -100, 150, 250);
+    $result = $filter->calcPosition(10, -100, 150, 250, false, false);
     $this->assertEqual($result[0], 10);
     $this->assertEqual($result[1], 150);
 
-    $result = $filter->calcPosition(-10, -100, 150, 250);
+    $result = $filter->calcPosition(-10, -100, 150, 250, false, false);
     $this->assertEqual($result[0], 140);
-    $this->assertEqual($result[1], 150);
+    $this->assertEqual($result[1], 150);
+    
+    $result = $filter->calcPosition(0, 0, 150, 250, 10, false);
+    $this->assertEqual($result[0], 70);
+    $this->assertEqual($result[1], 0);
+    
+    $result = $filter->calcPosition(0, 0, 150, 250, false, 10);
+    $this->assertEqual($result[0], 0);
+    $this->assertEqual($result[1], 120);
+    
+    $result = $filter->calcPosition(-5, 5, 150, 250, 20, 10);
+    $this->assertEqual($result[0], 60);
+    $this->assertEqual($result[1], 125);
   }
 
   function tearDown()

Modified: 3.x/trunk/limb/imagekit/tests/cases/gd/lmbGdImageConvertorTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/gd/lmbGdImageConvertorTest.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/tests/cases/gd/lmbGdImageConvertorTest.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -21,9 +21,9 @@
     return dirname(__FILE__).'/../../var/output.jpg';
   }
 
-  function _getConvertor()
+  function _getConvertor($params = array())
   {
-    return new lmbGdImageConvertor();
+    return new lmbGdImageConvertor($params);
   }
 
   function testApply()
@@ -64,6 +64,23 @@
     list($width, $height, $type) = getimagesize($this->_getOutputImage());
     $this->assertEqual($width, 60);
     $this->assertEqual($height, 50);
+  }
+  
+  function testFilterLocator()
+  {
+    $path = dirname(__FILE__).'/../../var/filters';    
+    $conv = $this->_getConvertor(array('add_filters_scan_dirs' => $path));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
+    $conv = $this->_getConvertor(array('add_filters_scan_dirs' => array($path)));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
+    $conv = $this->_getConvertor(array('filters_scan_dirs' => $path));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
+    $conv = $this->_getConvertor(array('filters_scan_dirs' => array($path)));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
   }
 
   function testCheckSupportConv()

Modified: 3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -22,9 +22,9 @@
     return dirname(__FILE__).'/../../var/output1.jpg';
   }
 
-  function _getConvertor()
+  function _getConvertor($params = array())
   {
-    return new lmbImImageConvertor();
+    return new lmbImImageConvertor($params);
   }
 
   function testApply()
@@ -76,6 +76,23 @@
     $this->assertFalse($conv->isSupportConversion($this->_getInputImage(), '', 'zxzx'));
   }
 
+  function testFilterLocator()
+  {
+    $path = dirname(__FILE__).'/../../var/filters';    
+    $conv = $this->_getConvertor(array('add_filters_scan_dirs' => $path));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
+    $conv = $this->_getConvertor(array('add_filters_scan_dirs' => array($path)));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
+    $conv = $this->_getConvertor(array('filters_scan_dirs' => $path));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
+    $conv = $this->_getConvertor(array('filters_scan_dirs' => array($path)));
+    $conv->load($this->_getInputImage());
+    $conv->apply('test');
+  }
+
   function tearDown()
   {
     @unlink($this->_getOutputImage());


Property changes on: 3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: 3.x/trunk/limb/imagekit/tests/cases/lmbImageKitTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/lmbImageKitTest.class.php	2008-04-25 14:29:00 UTC (rev 6959)
+++ 3.x/trunk/limb/imagekit/tests/cases/lmbImageKitTest.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -54,6 +54,12 @@
     list($width, $height, $type) = getimagesize($this->_getOutputImage());
     $this->assertEqual($width, 60);
     $this->assertEqual($height, 50);
+  }
+  
+  function testPassingParamsToConvertor()
+  {
+    lmbImageKit::load($this->_getInputImage(), '', 'gd', '', array('add_filters_scan_dirs' => dirname(__FILE__).'/../var/filters'))
+      ->test();
   }
 
   function tearDown()

Added: 3.x/trunk/limb/imagekit/tests/var/filters/lmbGdTestImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/var/filters/lmbGdTestImageFilter.class.php	                        (rev 0)
+++ 3.x/trunk/limb/imagekit/tests/var/filters/lmbGdTestImageFilter.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -0,0 +1,8 @@
+<?php
+class lmbGdTestImageFilter extends lmbAbstractImageFilter {
+  function apply(lmbAbstractImageContainer $container)
+  {
+    
+  }
+}
+?>
\ No newline at end of file


Property changes on: 3.x/trunk/limb/imagekit/tests/var/filters/lmbGdTestImageFilter.class.php
___________________________________________________________________
Name: svn:keywords
   + Id

Added: 3.x/trunk/limb/imagekit/tests/var/filters/lmbImTestImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/var/filters/lmbImTestImageFilter.class.php	                        (rev 0)
+++ 3.x/trunk/limb/imagekit/tests/var/filters/lmbImTestImageFilter.class.php	2008-04-26 20:45:33 UTC (rev 6960)
@@ -0,0 +1,8 @@
+<?php
+class lmbImTestImageFilter extends lmbAbstractImageFilter {
+  function apply(lmbAbstractImageContainer $container)
+  {
+    
+  }
+}
+?>
\ No newline at end of file


Property changes on: 3.x/trunk/limb/imagekit/tests/var/filters/lmbImTestImageFilter.class.php
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the limb-svn mailing list