[limb-svn] r7071 - in 3.x/trunk/limb/imagekit: src src/gd src/gd/filters src/im src/im/filters tests/cases tests/cases/gd tests/cases/gd/filters tests/cases/im
svn at limb-project.com
svn at limb-project.com
Wed Jun 25 18:33:31 MSD 2008
Author: korchasa
Date: 2008-06-25 18:33:29 +0400 (Wed, 25 Jun 2008)
New Revision: 7071
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7071
Modified:
3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php
3.x/trunk/limb/imagekit/src/gd/filters/lmbGdOutputImageFilter.class.php
3.x/trunk/limb/imagekit/src/gd/filters/lmbGdResizeImageFilter.class.php
3.x/trunk/limb/imagekit/src/gd/filters/lmbGdRotateImageFilter.class.php
3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php
3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php
3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php
3.x/trunk/limb/imagekit/src/im/filters/lmbImCropImageFilter.class.php
3.x/trunk/limb/imagekit/src/im/filters/lmbImOutputImageFilter.class.php
3.x/trunk/limb/imagekit/src/im/filters/lmbImResizeImageFilter.class.php
3.x/trunk/limb/imagekit/src/im/filters/lmbImRotateImageFilter.class.php
3.x/trunk/limb/imagekit/src/im/filters/lmbImWaterMarkImageFilter.class.php
3.x/trunk/limb/imagekit/src/im/lmbImImageContainer.class.php
3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php
3.x/trunk/limb/imagekit/src/lmbAbstractImageFilter.class.php
3.x/trunk/limb/imagekit/src/lmbImageKit.class.php
3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdRotateImageFilterTest.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:
-- fix relative path in imagekit package
Modified: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdCropImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Crop image filter
@@ -23,7 +23,7 @@
imagecopy($im, $container->getResource(), 0, 0, $x, $y, $width, $height);
$container->replaceResource($im);
}
-
+
function calculateCropArea($image_width, $image_height)
{
$width = $this->getWidth();
@@ -32,15 +32,15 @@
$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);
}
@@ -53,7 +53,7 @@
{
return $this->getParam('height');
}
-
+
function getX()
{
return $this->getParam('x', 0);
Modified: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdOutputImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdOutputImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdOutputImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Change output type
Modified: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdResizeImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdResizeImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdResizeImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Resize image filter
Modified: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdRotateImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdRotateImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdRotateImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Rotate image filter
@@ -25,6 +25,10 @@
$bgcolor = $this->getBgColor();
$cur_im = $container->getResource();
$bg = imagecolorallocate($cur_im, $bgcolor['red'], $bgcolor['green'], $bgcolor['blue']);
+
+ lmb_require('limb/core/src/lmbBacktrace.class.php');
+ $back = new lmbBacktrace();
+ echo $back->toString();
$im = imagerotate($cur_im, $angle, $bg);
$container->replaceResource($im);
}
Modified: 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/gd/filters/lmbGdWaterMarkImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Resize image filter
@@ -37,7 +37,7 @@
* @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
+ * @param mixed $wm_height height of a watermark
* @return array (x, y)
*/
function calcPosition($x, $y, $width, $height, $wm_width = false, $wm_height = false)
@@ -49,7 +49,7 @@
else
{
if($x < 0)
- $x += $width;
+ $x += $width;
}
if($wm_height !== false)
{
@@ -58,7 +58,7 @@
else
{
if($y < 0)
- $y += $height;
+ $y += $height;
}
return array($x, $y);
}
@@ -82,12 +82,12 @@
{
return $this->getParam('opacity', 0);
}
-
+
function getXCenter()
{
return $this->getParam('xcenter', false);
}
-
+
function getYCenter()
{
return $this->getParam('ycenter', false);
Modified: 3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,10 +7,10 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../lmbAbstractImageContainer.class.php');
-lmb_require(dirname(__FILE__).'/../exception/lmbImageTypeNotSupportedException.class.php');
-lmb_require(dirname(__FILE__).'/../exception/lmbImageCreateFailedException.class.php');
-lmb_require(dirname(__FILE__).'/../exception/lmbImageSaveFailedException.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageContainer.class.php');
+lmb_require('limb/imagekit/src/exception/lmbImageTypeNotSupportedException.class.php');
+lmb_require('limb/imagekit/src/exception/lmbImageCreateFailedException.class.php');
+lmb_require('limb/imagekit/src/exception/lmbImageSaveFailedException.class.php');
lmb_require('limb/fs/src/exception/lmbFileNotFoundException.class.php');
/**
Modified: 3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/gd/lmbGdImageConvertor.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,8 +7,8 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../lmbAbstractImageConvertor.class.php');
-lmb_require(dirname(__FILE__).'/lmbGdImageContainer.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageConvertor.class.php');
+lmb_require('limb/imagekit/src/gd/lmbGdImageContainer.class.php');
lmb_require('limb/fs/src/exception/lmbFileNotFoundException.class.php');
lmb_require('limb/imagekit/src/exception/lmbImageLibraryNotInstalledException.class.php');
@@ -25,12 +25,12 @@
{
if (!function_exists('gd_info'))
throw new lmbImageLibraryNotInstalledException('gd');
-
+
if(!isset($params['filters_scan_dirs']))
- $params['filters_scan_dirs'] = dirname(__FILE__).'/filters';
+ $params['filters_scan_dirs'] = 'limb/imagekit/src/gd/filters';
parent::__construct($params);
}
-
+
protected function createFilter($name, $params)
{
$class = $this->loadFilter($name, 'Gd', $params);
Modified: 3.x/trunk/limb/imagekit/src/im/filters/lmbImCropImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/filters/lmbImCropImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/im/filters/lmbImCropImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Crop image filter
@@ -21,7 +21,7 @@
list($x, $y, $width, $height) = $this->calculateCropArea($container->getWidth(), $container->getHeight());
$container->getResource()->cropImage($width, $height, $x, $y);
}
-
+
function calculateCropArea($image_width, $image_height)
{
$width = $this->getWidth();
@@ -30,15 +30,15 @@
$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);
}
@@ -51,7 +51,7 @@
{
return $this->getParam('height');
}
-
+
function getX()
{
return $this->getParam('x', 0);
Modified: 3.x/trunk/limb/imagekit/src/im/filters/lmbImOutputImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/filters/lmbImOutputImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/im/filters/lmbImOutputImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,14 +7,14 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Change output type
* @package imagekit
* @version $Id$
*/
-class lmbImOutputImageFilter extends lmbAbstractImageFilter
+class lmbImOutputImageFilter extends lmbAbstractImageFilter
{
function apply(lmbAbstractImageContainer $container)
Modified: 3.x/trunk/limb/imagekit/src/im/filters/lmbImResizeImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/filters/lmbImResizeImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/im/filters/lmbImResizeImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Resize image filter
@@ -63,10 +63,10 @@
{
return $this->getParam('save_min_size', false);
}
-
+
function getXxx()
{
return $this->getParam('xxx', false);
}
-
+
}
Modified: 3.x/trunk/limb/imagekit/src/im/filters/lmbImRotateImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/filters/lmbImRotateImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/im/filters/lmbImRotateImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Rotate image filter
Modified: 3.x/trunk/limb/imagekit/src/im/filters/lmbImWaterMarkImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/filters/lmbImWaterMarkImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/im/filters/lmbImWaterMarkImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../../lmbAbstractImageFilter.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageFilter.class.php');
/**
* Watermark image filter
Modified: 3.x/trunk/limb/imagekit/src/im/lmbImImageContainer.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/lmbImImageContainer.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/im/lmbImImageContainer.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,10 +7,10 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/../lmbAbstractImageContainer.class.php');
-lmb_require(dirname(__FILE__).'/../exception/lmbImageTypeNotSupportedException.class.php');
-lmb_require(dirname(__FILE__).'/../exception/lmbImageCreateFailedException.class.php');
-lmb_require(dirname(__FILE__).'/../exception/lmbImageSaveFailedException.class.php');
+lmb_require('limb/imagekit/src/im/lmbAbstractImageContainer.class.php');
+lmb_require('limb/imagekit/src/exception/lmbImageTypeNotSupportedException.class.php');
+lmb_require('limb/imagekit/src/exception/lmbImageCreateFailedException.class.php');
+lmb_require('limb/imagekit/src/exception/lmbImageSaveFailedException.class.php');
lmb_require('limb/fs/src/exception/lmbFileNotFoundException.class.php');
/**
@@ -39,7 +39,7 @@
}
$this->out_type = $type;
}
-
+
parent::setOutputType($type);
}
Modified: 3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/im/lmbImImageConvertor.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -1,62 +1,61 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-lmb_require(dirname(__FILE__).'/../lmbAbstractImageConvertor.class.php');
-lmb_require(dirname(__FILE__).'/lmbImImageContainer.class.php');
-lmb_require('limb/fs/src/exception/lmbFileNotFoundException.class.php');
-lmb_require('limb/imagekit/src/exception/lmbImageLibraryNotInstalledException.class.php');
-
-
-/**
- * Imagick image convertor
- *
- * @package imagekit
- * @version $Id$
- */
-class lmbImImageConvertor extends lmbAbstractImageConvertor
-{
-
- function __construct($params = array())
- {
- if (!class_exists('Imagick'))
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+lmb_require('limb/imagekit/src/lmbAbstractImageConvertor.class.php');
+lmb_require('limb/imagekit/src/im/lmbImImageContainer.class.php');
+lmb_require('limb/fs/src/exception/lmbFileNotFoundException.class.php');
+lmb_require('limb/imagekit/src/exception/lmbImageLibraryNotInstalledException.class.php');
+
+/**
+ * Imagick image convertor
+ *
+ * @package imagekit
+ * @version $Id$
+ */
+class lmbImImageConvertor extends lmbAbstractImageConvertor
+{
+
+ function __construct($params = array())
+ {
+ if (!class_exists('Imagick'))
throw new lmbImageLibraryNotInstalledException('ImageMagick');
-
+
if(!isset($params['filters_scan_dirs']))
- $params['filters_scan_dirs'] = dirname(__FILE__).'/filters';
+ $params['filters_scan_dirs'] = 'limb/imagekit/src/im/filters';
parent::__construct($params);
- }
-
- protected function createFilter($name, $params)
- {
- $class = $this->loadFilter($name, 'Im');
- return new $class($params);
- }
-
- protected function createImageContainer($file_name, $type = '')
- {
- $container = new lmbImImageContainer();
- $container->load($file_name, $type);
- return $container;
- }
-
- function isSupportConversion($file, $src_type = '', $dest_type = '')
- {
- if(!$src_type)
- {
- $imginfo = getimagesize($file);
- if(!$imginfo)
- throw new lmbFileNotFoundException($file);
- $src_type = lmbImImageContainer::convertImageType($imginfo[2]);
- }
- if(!$dest_type)
- $dest_type = $src_type;
- return lmbImImageContainer::supportLoadType($src_type) &&
- lmbImImageContainer::supportSaveType($dest_type);
- }
-}
+ }
+
+ protected function createFilter($name, $params)
+ {
+ $class = $this->loadFilter($name, 'Im');
+ return new $class($params);
+ }
+
+ protected function createImageContainer($file_name, $type = '')
+ {
+ $container = new lmbImImageContainer();
+ $container->load($file_name, $type);
+ return $container;
+ }
+
+ function isSupportConversion($file, $src_type = '', $dest_type = '')
+ {
+ if(!$src_type)
+ {
+ $imginfo = getimagesize($file);
+ if(!$imginfo)
+ throw new lmbFileNotFoundException($file);
+ $src_type = lmbImImageContainer::convertImageType($imginfo[2]);
+ }
+ if(!$dest_type)
+ $dest_type = $src_type;
+ return lmbImImageContainer::supportLoadType($src_type) &&
+ lmbImImageContainer::supportSaveType($dest_type);
+ }
+}
Modified: 3.x/trunk/limb/imagekit/src/lmbAbstractImageFilter.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/lmbAbstractImageFilter.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/lmbAbstractImageFilter.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -7,7 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
-lmb_require(dirname(__FILE__).'/lmbAbstractImageContainer.class.php');
+lmb_require('limb/imagekit/src/lmbAbstractImageContainer.class.php');
/**
* Abstract image filter
Modified: 3.x/trunk/limb/imagekit/src/lmbImageKit.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/lmbImageKit.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/src/lmbImageKit.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -21,7 +21,7 @@
$image_class_name = 'lmb' . ucfirst($library) . 'ImageConvertor';
- $class_path = dirname(__FILE__) . '/'. $library . '/' . $image_class_name . '.class.php';
+ $class_path = 'limb/imagekit/src/' . $library . '/' . $image_class_name . '.class.php';
if(!file_exists($class_path))
throw new lmbFileNotFoundException($class_path, 'image library not found');
Modified: 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdRotateImageFilterTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdRotateImageFilterTest.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/tests/cases/gd/filters/lmbGdRotateImageFilterTest.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -12,6 +12,11 @@
class lmbGdRotateImageFilterTest extends UnitTestCase {
+ function skip()
+ {
+ $this->skipIf(!function_exists('imagerotate'), 'imagerotate() function does not exist. Test skipped.');
+ }
+
function _getInputImage()
{
return dirname(__FILE__).'/../../../var/input.jpg';
Modified: 3.x/trunk/limb/imagekit/tests/cases/gd/lmbGdImageConvertorTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/gd/lmbGdImageConvertorTest.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/tests/cases/gd/lmbGdImageConvertorTest.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -1,74 +1,79 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-lmb_require(dirname(__FILE__).'/../../../src/gd/lmbGdImageConvertor.class.php');
-
-class lmbGdImageConvertorTest extends UnitTestCase {
-
- function _getInputImage()
- {
- return dirname(__FILE__).'/../../var/input.jpg';
- }
-
- function _getOutputImage()
- {
- return dirname(__FILE__).'/../../var/output.jpg';
- }
-
- function _getConvertor($params = array())
- {
- return new lmbGdImageConvertor($params);
- }
-
- function testApply()
- {
- $conv = $this->_getConvertor();
- $conv->load($this->_getInputImage());
- $conv->apply('resize', array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false));
-
- $conv->save($this->_getOutputImage());
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 50);
- $this->assertEqual($height, 70);
- }
-
- function testApplyByOverload()
- {
- $conv = $this->_getConvertor();
- $conv->load($this->_getInputImage());
- $conv->resize(array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false));
-
- $conv->save($this->_getOutputImage());
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 50);
- $this->assertEqual($height, 70);
- }
-
- function testApplyBatch()
- {
- $batch = array(
- array('resize' => array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false)),
- array('rotate' => array('angle' => 90))
- );
- $conv = $this->_getConvertor();
- $conv->load($this->_getInputImage());
- $conv->applyBatch($batch);
-
- $conv->save($this->_getOutputImage());
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 60);
- $this->assertEqual($height, 50);
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+lmb_require(dirname(__FILE__).'/../../../src/gd/lmbGdImageConvertor.class.php');
+
+class lmbGdImageConvertorTest extends UnitTestCase {
+
+ function skip()
+ {
+ $this->skipIf(!function_exists('imagerotate'), 'imagerotate() function does not exist. Test skipped.');
}
-
+
+ function _getInputImage()
+ {
+ return dirname(__FILE__).'/../../var/input.jpg';
+ }
+
+ function _getOutputImage()
+ {
+ return dirname(__FILE__).'/../../var/output.jpg';
+ }
+
+ function _getConvertor($params = array())
+ {
+ return new lmbGdImageConvertor($params);
+ }
+
+ function testApply()
+ {
+ $conv = $this->_getConvertor();
+ $conv->load($this->_getInputImage());
+ $conv->apply('resize', array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false));
+
+ $conv->save($this->_getOutputImage());
+ list($width, $height, $type) = getimagesize($this->_getOutputImage());
+ $this->assertEqual($width, 50);
+ $this->assertEqual($height, 70);
+ }
+
+ function testApplyByOverload()
+ {
+ $conv = $this->_getConvertor();
+ $conv->load($this->_getInputImage());
+ $conv->resize(array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false));
+
+ $conv->save($this->_getOutputImage());
+ list($width, $height, $type) = getimagesize($this->_getOutputImage());
+ $this->assertEqual($width, 50);
+ $this->assertEqual($height, 70);
+ }
+
+ function testApplyBatch()
+ {
+ $batch = array(
+ array('resize' => array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false)),
+ array('rotate' => array('angle' => 90))
+ );
+ $conv = $this->_getConvertor();
+ $conv->load($this->_getInputImage());
+ $conv->applyBatch($batch);
+
+ $conv->save($this->_getOutputImage());
+ list($width, $height, $type) = getimagesize($this->_getOutputImage());
+ $this->assertEqual($width, 60);
+ $this->assertEqual($height, 50);
+ }
+
function testFilterLocator()
{
- $path = dirname(__FILE__).'/../../var/filters';
+ $path = dirname(__FILE__).'/../../var/filters';
$conv = $this->_getConvertor(array('add_filters_scan_dirs' => $path));
$conv->load($this->_getInputImage());
$conv->apply('test');
@@ -81,20 +86,20 @@
$conv = $this->_getConvertor(array('filters_scan_dirs' => array($path)));
$conv->load($this->_getInputImage());
$conv->apply('test');
- }
-
- function testCheckSupportConv()
- {
- $conv = $this->_getConvertor();
-
- $this->assertTrue($conv->isSupportConversion('', 'jpeg', 'gif'));
- $this->assertTrue($conv->isSupportConversion($this->_getInputImage()));
- $this->assertFalse($conv->isSupportConversion($this->_getInputImage(), '', 'zxzx'));
- }
-
- function tearDown()
- {
- @unlink($this->_getOutputImage());
- }
-}
+ }
+
+ function testCheckSupportConv()
+ {
+ $conv = $this->_getConvertor();
+
+ $this->assertTrue($conv->isSupportConversion('', 'jpeg', 'gif'));
+ $this->assertTrue($conv->isSupportConversion($this->_getInputImage()));
+ $this->assertFalse($conv->isSupportConversion($this->_getInputImage(), '', 'zxzx'));
+ }
+
+ function tearDown()
+ {
+ @unlink($this->_getOutputImage());
+ }
+}
?>
\ No newline at end of file
Modified: 3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/tests/cases/im/lmbImImageConvertorTest.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -1,84 +1,89 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-lmb_require(dirname(__FILE__).'/../../../src/im/lmbImImageConvertor.class.php');
-
-class lmbImImageConvertorTest extends UnitTestCase
-{
-
- function _getInputImage()
- {
- return dirname(__FILE__).'/../../var/input.jpg';
- }
-
- function _getOutputImage()
- {
- return dirname(__FILE__).'/../../var/output1.jpg';
- }
-
- function _getConvertor($params = array())
- {
- return new lmbImImageConvertor($params);
- }
-
- function testApply()
- {
- $conv = $this->_getConvertor();
- $conv->load($this->_getInputImage());
- $conv->apply('resize', array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false));
-
- $conv->save($this->_getOutputImage());
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 50);
- $this->assertEqual($height, 70);
- }
-
- function testApplyByOverload()
- {
- $conv = $this->_getConvertor();
- $conv->load($this->_getInputImage());
- $conv->resize(array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false, 'xxx' => true));
-
- $conv->save($this->_getOutputImage());
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 50);
- $this->assertEqual($height, 70);
- }
-
- function testApplyBatch()
- {
- $batch = array(
- array('resize' => array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false, 'xxx' => true)),
- array('rotate' => array('angle' => 90))
- );
- $conv = $this->_getConvertor();
- $conv->load($this->_getInputImage());
- $conv->applyBatch($batch);
-
- $conv->save($this->_getOutputImage());
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 60);
- $this->assertEqual($height, 50);
- }
-
- function testCheckSupportConv()
- {
- $conv = $this->_getConvertor();
-
- $this->assertTrue($conv->isSupportConversion('', 'jpeg', 'gif'));
- $this->assertTrue($conv->isSupportConversion($this->_getInputImage()));
- $this->assertFalse($conv->isSupportConversion($this->_getInputImage(), '', 'zxzx'));
- }
-
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+lmb_require(dirname(__FILE__).'/../../../src/im/lmbImImageConvertor.class.php');
+
+class lmbImImageConvertorTest extends UnitTestCase
+{
+ function skip()
+ {
+ $this->skipIf(!function_exists('imagerotate'), 'imagerotate() function does not exist. Test skipped.');
+ }
+
+ function _getInputImage()
+ {
+ return dirname(__FILE__).'/../../var/input.jpg';
+ }
+
+ function _getOutputImage()
+ {
+ return dirname(__FILE__).'/../../var/output1.jpg';
+ }
+
+ function _getConvertor($params = array())
+ {
+ return new lmbImImageConvertor($params);
+ }
+
+ function testApply()
+ {
+ $conv = $this->_getConvertor();
+ $conv->load($this->_getInputImage());
+ $conv->apply('resize', array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false));
+
+ $conv->save($this->_getOutputImage());
+ list($width, $height, $type) = getimagesize($this->_getOutputImage());
+ $this->assertEqual($width, 50);
+ $this->assertEqual($height, 70);
+ }
+
+ function testApplyByOverload()
+ {
+ $conv = $this->_getConvertor();
+ $conv->load($this->_getInputImage());
+ $conv->resize(array('width' => 50, 'height' => 70, 'preserve_aspect_ratio' => false, 'xxx' => true));
+
+ $conv->save($this->_getOutputImage());
+ list($width, $height, $type) = getimagesize($this->_getOutputImage());
+ $this->assertEqual($width, 50);
+ $this->assertEqual($height, 70);
+ }
+
+ function testApplyBatch()
+ {
+
+ $batch = array(
+ array('resize' => array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false, 'xxx' => true)),
+ array('rotate' => array('angle' => 90))
+ );
+ $conv = $this->_getConvertor();
+ $conv->load($this->_getInputImage());
+ $conv->applyBatch($batch);
+
+ $conv->save($this->_getOutputImage());
+ list($width, $height, $type) = getimagesize($this->_getOutputImage());
+ $this->assertEqual($width, 60);
+ $this->assertEqual($height, 50);
+ }
+
+ function testCheckSupportConv()
+ {
+ $conv = $this->_getConvertor();
+
+ $this->assertTrue($conv->isSupportConversion('', 'jpeg', 'gif'));
+ $this->assertTrue($conv->isSupportConversion($this->_getInputImage()));
+ $this->assertFalse($conv->isSupportConversion($this->_getInputImage(), '', 'zxzx'));
+ }
+
function testFilterLocator()
{
- $path = dirname(__FILE__).'/../../var/filters';
+ $path = dirname(__FILE__).'/../../var/filters';
$conv = $this->_getConvertor(array('add_filters_scan_dirs' => $path));
$conv->load($this->_getInputImage());
$conv->apply('test');
@@ -93,8 +98,8 @@
$conv->apply('test');
}
- function tearDown()
- {
- @unlink($this->_getOutputImage());
- }
-}
+ function tearDown()
+ {
+ @unlink($this->_getOutputImage());
+ }
+}
Modified: 3.x/trunk/limb/imagekit/tests/cases/lmbImageKitTest.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/tests/cases/lmbImageKitTest.class.php 2008-06-25 14:04:40 UTC (rev 7070)
+++ 3.x/trunk/limb/imagekit/tests/cases/lmbImageKitTest.class.php 2008-06-25 14:33:29 UTC (rev 7071)
@@ -1,69 +1,70 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-lmb_require(dirname(__FILE__).'/../../src/lmbImageKit.class.php');
-
-class lmbImageKitTest extends UnitTestCase
-{
- function skip()
- {
- $this->skipIf(!extension_loaded('gd'), 'GD extension not found. Test skipped.');
- }
-
- function _getInputImage()
- {
- return dirname(__FILE__).'/../var/input.jpg';
- }
-
- function _getOutputImage()
- {
- return dirname(__FILE__).'/../var/output.jpg';
- }
-
- function testCreateGdConvertor()
- {
- $conv = lmbImageKit::create('gd');
- $this->assertIsA($conv, 'lmbGdImageConvertor');
- }
-
- function testTraversing()
- {
- lmbImageKit::load($this->_getInputImage())->
- apply('resize', array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false))->
- apply('rotate', array('angle' => 90))->
- save($this->_getOutputImage());
-
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 60);
- $this->assertEqual($height, 50);
- }
-
- function testTraversingByOverloading()
- {
- lmbImageKit::load($this->_getInputImage())->
- resize(array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false))->
- rotate(array('angle' => 90))->
- save($this->_getOutputImage());
-
- list($width, $height, $type) = getimagesize($this->_getOutputImage());
- $this->assertEqual($width, 60);
- $this->assertEqual($height, 50);
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+lmb_require(dirname(__FILE__).'/../../src/lmbImageKit.class.php');
+
+class lmbImageKitTest extends UnitTestCase
+{
+ function skip()
+ {
+ $this->skipIf(!extension_loaded('gd'), 'GD extension not found. Test skipped.');
+ $this->skipIf(!function_exists('imagerotate'), 'imagerotate() function does not exist. Test skipped.');
}
-
+
+ function _getInputImage()
+ {
+ return dirname(__FILE__).'/../var/input.jpg';
+ }
+
+ function _getOutputImage()
+ {
+ return dirname(__FILE__).'/../var/output.jpg';
+ }
+
+ function testCreateGdConvertor()
+ {
+ $conv = lmbImageKit::create('gd');
+ $this->assertIsA($conv, 'lmbGdImageConvertor');
+ }
+
+ function testTraversing()
+ {
+ lmbImageKit::load($this->_getInputImage())->
+ apply('resize', array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false))->
+ apply('rotate', array('angle' => 90))->
+ save($this->_getOutputImage());
+
+ list($width, $height, $type) = getimagesize($this->_getOutputImage());
+ $this->assertEqual($width, 60);
+ $this->assertEqual($height, 50);
+ }
+
+ function testTraversingByOverloading()
+ {
+ lmbImageKit::load($this->_getInputImage())->
+ resize(array('width' => 50, 'height' => 60, 'preserve_aspect_ratio' => false))->
+ rotate(array('angle' => 90))->
+ save($this->_getOutputImage());
+
+ 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()
- {
- @unlink($this->_getOutputImage());
- }
-}
+ }
+
+ function tearDown()
+ {
+ @unlink($this->_getOutputImage());
+ }
+}
More information about the limb-svn
mailing list