Permalink
Browse files

enhance applyFilters method and niceup code a little bit

  • Loading branch information...
1 parent c052b89 commit 4f27bb7c04f002128178056ef55c5b3ec6837a5a @seebi seebi committed Sep 9, 2011
Showing with 7 additions and 6 deletions.
  1. +7 −6 instantpicture.inc.php
@@ -45,13 +45,12 @@ class InstantPicture
var $debugtype = 'jpg';
- function InstantPicture($config=array(),$imagefile=null,$filters=array())
+ function InstantPicture($config = array(), $imagefile = null, $filters = array())
{
-
- if ($config['quality']) $this->quality = $config['quality'];
- if ($config['debug']) $this->debug = $config['debug'];
- if ($config['debugtype']) $this->debugtype = $config['debugtype'];
- return $this->apply($imagefile,$filters);
+ $this->quality = (isset($config['quality'])) ? $config['quality'] : $this->quality;
+ $this->debug = (isset($config['debug'])) ? $config['debug'] : $this->debug;
+ $this->debugtype = (isset($config['debugtype'])) ? $config['debugtype'] : $this->debugtype;
+ return $this->apply($imagefile, $filters);
}
function setImageType($type)
@@ -226,6 +225,8 @@ function applyFilter($filter)
function applyFilters($filters)
{
+ // preset to true in order to allow an empty filters array
+ $r = true;
foreach ($filters as $filter)
{
$r = $this->applyFilter($filter);

0 comments on commit 4f27bb7

Please sign in to comment.