show meaningful error message for invalid width, resolves #74
authorAndreas Unterkircher <unki@netshadow.at>
Sat, 20 Sep 2008 14:03:59 +0000 (16:03 +0200)
committerAndreas Unterkircher <unki@netshadow.at>
Sat, 20 Sep 2008 15:25:53 +0000 (17:25 +0200)
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
CHANGELOG
phpfspot.class.php
phpfspot_img.php

index 1ff2c36163fac774bba692456563fc61bb170663..3c98d3f114047576bfb1c5ff6876d2d7f9eae63f 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,9 @@
 phpfspot (1.7)
 
 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 <unki@netshadow.at>  Fri, 18 Aug 2008 06:09:00 +0200
+ -- Andreas Unterkircher <unki@netshadow.at>  Fri, 20 Sep 2008 06:09:00 +0200
 
 phpfspot (1.6)
 
 
 phpfspot (1.6)
 
index f54a5d69c7a9a96c72d01409c64486b9d67f98f1..92c0fd2e69da2efa3c1d5a86a82f087f346d43dd 100644 (file)
@@ -3780,6 +3780,22 @@ class PHPFSPOT {
 
    } // get_photo_version_name()
 
 
    } // 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
 
 ?>
 } // class PHPFSPOT
 
 ?>
index 5ef76b4ea97a9e95c3595ba4c6930846b8f5427c..bb7e93f15f0c5890f8bf8b0e0f57496b7bdcdabc 100644 (file)
@@ -87,6 +87,10 @@ class PHPFSPOT_IMG {
       /* show thumbnail */
       else {
 
       /* 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.
          */
          /* check for an entry if we already handled this photo before. If not,
             create a thumbnail for it.
          */