check if F-Spot database file exists and is readable
[phpfspot.git] / phpfspot.class.php
index f54a5d69c7a9a96c72d01409c64486b9d67f98f1..9b24d3bb05e338d507c89814b4510e66457debeb 100644 (file)
@@ -141,6 +141,12 @@ class PHPFSPOT {
 
       /******* Opening F-Spot's sqlite database *********/
 
+      /* Check if database file exists and is readable */
+      if(!file_exists($this->cfg->fspot_db) || !is_readable($this->cfg->fspot_db)) {
+         print "Error: ". $this->cfg->fspot_db ." does not exist or is not readable for user ". $this->getuid() .".\n";
+         exit(1);
+      }
+
       /* Check if database file is writeable */
       if(!is_writeable($this->cfg->fspot_db)) {
          print "Error: ". $this->cfg->fspot_db ." is not writeable for user ". $this->getuid() .".\n";
@@ -3780,6 +3786,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
 
 ?>