alternate text if thumbnail is not available
[phpfspot.git] / phpfspot.class.php
index b0440245b4014926d5646a6c7ddc04320b4c6852..2ffec5fa82b5c7f24ddd90c2483981884d5624db 100644 (file)
@@ -194,7 +194,7 @@ class PHPFSPOT {
           // and add the $min_size set above
          $size = $min_size + (($value - $min_qty) * $step);
           // uncomment if you want sizes in whole %:
-          // $size = ceil($size);
+         $size = ceil($size);
 
          print "<a href=\"javascript:Tags('add', ". $key .");\" class=\"tag\" style=\"font-size: ". $size ."%;\">". $this->tags[$key] ."</a>&nbsp;";
 
@@ -536,50 +536,39 @@ class PHPFSPOT {
 
    } // check_config_table
 
-   public function gen_thumbs($idx = 0, $fromcmd = 0)
+   public function gen_thumb($idx = 0, $fromcmd = 0)
    {
-      if(!$idx) {
-         /* get all available photos */
-         $all = $this->getPhotoSelection();
-      }
-      else
-         $all = Array($idx);
-      
-      foreach($all as $photo) {
+      $details = $this->get_photo_details($idx);
 
-         $details = $this->get_photo_details($photo);
+      $full_path = $this->translate_path($details['directory_path'])  ."/". $details['name'];
+      $file_md5 = md5_file($full_path);
 
-         $full_path = $this->translate_path($details['directory_path'])  ."/". $details['name'];
-         $file_md5 = md5_file($full_path);
+      if($fromcmd) print "Image [". $idx ."] ". $details['name'] ." Thumbnails:";
 
-         if($fromcmd) print "Image ". $details['name'] ." Thumbnails:";
-
-         /* if the file hasn't changed there is no need to regen the thumb */
-         if($file_md5 == $this->getMD5($photo)) {
-            if($fromcmd) print " file has not changed - skipping\n";
-            continue;
-         }
-
-         /* set the new/changed MD5 sum for the current photo */
-         $this->setMD5($photo, $file_md5);
+      /* if the file hasn't changed there is no need to regen the thumb */
+      if($file_md5 == $this->getMD5($idx)) {
+         if($fromcmd) print " file has not changed - skipping\n";
+         return;
+      }
 
-         $resolutions = Array(
-                           $this->cfg->thumb_width,
-                           $this->cfg->bubble_width,
-                           $this->cfg->photo_width
-                        );
+      /* set the new/changed MD5 sum for the current photo */
+      $this->setMD5($idx, $file_md5);
 
-         /* create thumbnails for the requested resolutions */
-         foreach($resolutions as $resolution) {
-            if($fromcmd) print " ". $resolution ."px";
-            $this->create_thumbnail($full_path, $resolution);
-         }
-
-         if($fromcmd) print "\n";
+      $resolutions = Array(
+         $this->cfg->thumb_width,
+         $this->cfg->bubble_width,
+         $this->cfg->photo_width
+      );
 
+      /* create thumbnails for the requested resolutions */
+      foreach($resolutions as $resolution) {
+         if($fromcmd) print " ". $resolution ."px";
+         $this->create_thumbnail($full_path, $resolution);
       }
 
-   } // gen_thumbs()
+      if($fromcmd) print "\n";
+
+   } // gen_thumb()
 
    private function getMD5($idx)
    {