From 37d9c8bf7eb7c4244f93d9ed780333ec1fa4ae86 Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sat, 20 Sep 2008 16:03:59 +0200 Subject: [PATCH] show meaningful error message for invalid width, resolves #74 Signed-off-by: Andreas Unterkircher --- CHANGELOG | 5 +++-- phpfspot.class.php | 16 ++++++++++++++++ phpfspot_img.php | 4 ++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1ff2c36..3c98d3f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,9 @@ phpfspot (1.7) - * feature, F-Spot photo versioning + * feature, F-Spot photo versioning, #67 + * bug, display warning when requesting invalid image size, #74 - -- Andreas Unterkircher Fri, 18 Aug 2008 06:09:00 +0200 + -- Andreas Unterkircher Fri, 20 Sep 2008 06:09:00 +0200 phpfspot (1.6) diff --git a/phpfspot.class.php b/phpfspot.class.php index f54a5d6..92c0fd2 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -3780,6 +3780,22 @@ class PHPFSPOT { } // get_photo_version_name() + /** + */ + public function is_valid_width($image_width) + { + if(in_array($image_width, + Array($this->cfg->thumb_width, + $this->cfg->photo_width, + $this->cfg->mini_width, + 30))) + + return true; + + return false; + + } // is_valid_width() + } // class PHPFSPOT ?> diff --git a/phpfspot_img.php b/phpfspot_img.php index 5ef76b4..bb7e93f 100644 --- a/phpfspot_img.php +++ b/phpfspot_img.php @@ -87,6 +87,10 @@ class PHPFSPOT_IMG { /* show thumbnail */ else { + if(!$this->parent->is_valid_width($width)) { + $this->parent->showTextImage("Requested width ". $width ."px is not valid!"); + return; + } /* check for an entry if we already handled this photo before. If not, create a thumbnail for it. */ -- 2.17.1