remove unity from template, its now provided via php script
[phpfspot.git] / phpfspot.class.php
index fb54eb6cf87258fa7dd9401308919b8b9976a2e0..4468a5e719b25920fb5a7b61f80ec49dfece20cd 100644 (file)
@@ -138,11 +138,11 @@ class PHPFSPOT {
       $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->photo_width ."_". $this->getMD5($photo);
 
       if(!file_exists($orig_path)) {
-         print "Photo ". $orig_path ." does not exist!<br />\n";
+         $this->_warning("Photo ". $orig_path ." does not exist!<br />\n");
       }
 
       if(!is_readable($orig_path)) {
-         print "Photo ". $orig_path ." is not readable for user ". get_current_user() ."<br />\n";
+         $this->_warning("Photo ". $orig_path ." is not readable for user ". get_current_user() ."<br />\n");
       }
 
       /* If the thumbnail doesn't exist yet, try to create it */
@@ -172,7 +172,7 @@ class PHPFSPOT {
          $this->tmpl->assign('tags', $this->get_photo_tags($photo));
       }
       else {
-         print "Can't open file ". $thumb_path ."\n";
+         $this->_warning("Can't open file ". $thumb_path ."\n");
       }
 
       if($previous_img) {
@@ -479,12 +479,12 @@ class PHPFSPOT {
       $filesize = rand($filesize/1024, 2);
 
       if(!file_exists($orig_path)) {
-         print "Photo ". $orig_path ." does not exist!<br />\n";
+         $this->_warning("Photo ". $orig_path ." does not exist!<br />\n");
          return;
       }
       
       if(!is_readable($orig_path)) {
-         print "Photo ". $orig_path ." is not readable for user ". get_current_user() ."<br />\n";
+         $this->_warning("Photo ". $orig_path ." is not readable for user ". get_current_user() ."<br />\n");
          return;
       }
 
@@ -516,7 +516,7 @@ class PHPFSPOT {
       $details = getimagesize($orig_image);
       
       /* check if original photo is a support image type */
-      if(!$this->parent->checkifImageSupported($details['mime']))
+      if(!$this->checkifImageSupported($details['mime']))
          return false;
 
       $meta = $this->get_meta_informations($orig_image);
@@ -654,6 +654,17 @@ class PHPFSPOT {
 
       /* calculate file MD5 sum */
       $full_path = $this->translate_path($details['directory_path'])  ."/". $details['name'];
+
+      if(!file_exists($full_path)) {
+         $this->_warning("File ". $full_path ." does not exist\n");
+         return;
+      }
+
+      if(!is_readable($full_path)) {
+         $this->_warning("File ". $full_path ." is not readable for ". get_current_user() ."\n");
+         return;
+      }
+
       $file_md5 = md5_file($full_path);
 
       $this->_debug("Image [". $idx ."] ". $details['name'] ." Thumbnails:");
@@ -892,6 +903,13 @@ class PHPFSPOT {
 
    } // checkifImageSupported()
 
+   public function _warning($text)
+   {
+      print "<img src=\"resources/green_info.png\" alt=\"warning\" />\n";
+      print $text;
+
+   } // _warning()
+
 }
 
 ?>