[limb-svn] r6330 - 3.x/trunk/limb/imagekit/src/gd
svn at limb-project.com
svn at limb-project.com
Fri Sep 21 15:03:44 MSD 2007
Author: pachanga
Date: 2007-09-21 15:03:44 +0400 (Fri, 21 Sep 2007)
New Revision: 6330
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6330
Modified:
3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php
Log:
-- minor code beautifyings
Modified: 3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php
===================================================================
--- 3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php 2007-09-21 06:35:28 UTC (rev 6329)
+++ 3.x/trunk/limb/imagekit/src/gd/lmbGdImageContainer.class.php 2007-09-21 11:03:44 UTC (rev 6330)
@@ -46,22 +46,34 @@
function load($file_name, $type = '')
{
$imginfo = @getimagesize($file_name);
- if(!$imginfo) throw new lmbFileNotFoundException($file_name);
- if(!$type) $type = self::convertImageType($imginfo[2]);
- if(!self::supportLoadType($type)) throw new lmbImageTypeNotSupportException($type);
+ if(!$imginfo)
+ throw new lmbFileNotFoundException($file_name);
+
+ if(!$type)
+ $type = self::convertImageType($imginfo[2]);
+
+ if(!self::supportLoadType($type))
+ throw new lmbImageTypeNotSupportException($type);
+
$createfunc = 'imagecreatefrom'.$type;
if(!($this->img = @$createfunc($file_name)))
- throw new lmbImageCreateFailedException($file_name);
+ throw new lmbImageCreateFailedException($file_name);
+
$this->img_type = $type;
}
function save($file_name = null, $type = '')
{
- if(!$type) $type = $this->img_type;
- if(!self::supportSaveType($type)) throw new lmbImageTypeNotSupportException($type);
+ if(!$type)
+ $type = $this->img_type;
+
+ if(!self::supportSaveType($type))
+ throw new lmbImageTypeNotSupportException($type);
+
$imagefunc = 'image'.$type;
if(!@$imagefunc($this->img, $file_name))
- throw new lmbImageSaveFailedException($file_name);
+ throw new lmbImageSaveFailedException($file_name);
+
$this->destroyImage();
}
@@ -93,7 +105,8 @@
function destroyImage()
{
- if(!$this->img) return;
+ if(!$this->img)
+ return;
imagedestroy($this->img);
$this->img = null;
}
@@ -110,9 +123,11 @@
static function supportType($type)
{
- if(!function_exists('imagetypes')) return false;
+ if(!function_exists('imagetypes'))
+ return false;
$gdtype = self::getGdType($type);
- if($gdtype === false) return false;
+ if($gdtype === false)
+ return false;
return (boolean)(imagetypes() & $gdtype);
}
@@ -136,4 +151,4 @@
$this->destroyImage();
}
}
-?>
\ No newline at end of file
+
More information about the limb-svn
mailing list