added some comments to the config file
[phpfspot.git] / phpfspot.class.php
index 948a87e56fb3cd9463e5bab647e3093fcfcb027e..3f7a7280253b04cdd44110ee3188ee7560610882 100644 (file)
@@ -262,7 +262,7 @@ class PHPFSPOT {
 
       $details = $this->get_photo_details($photo);
 
-      $image_url = "phpfspot_img.php?idx=". $photo ."&width=200";
+      $image_url = "phpfspot_img.php?idx=". $photo ."&width=". $this->cfg->bubble_width;
 
       $filesize = filesize($this->translate_path($details['directory_path'])  ."/". $details['name']);
       $filesize = rand($filesize/1024, 2);
@@ -360,16 +360,22 @@ class PHPFSPOT {
 
    } // check_config_table
 
-   public function gen_thumbs($fromcmd = 0)
+   public function gen_thumbs($idx = 0, $fromcmd = 0)
    {
-      /* get all available photos */
-      $all = $this->getAllTagPhotos();                                                                                                                                                                    
+      if(!$idx) {
+         /* get all available photos */
+         $all = $this->getAllTagPhotos();
+      }
+      else
+         $all = Array($idx);
+      
       foreach($all as $photo) {
 
+         $details = $this->get_photo_details($photo);
+
          $full_path = $this->translate_path($details['directory_path'])  ."/". $details['name'];
          $file_md5 = md5_file($full_path);
 
-         $details = $this->get_photo_details($photo);
          if($fromcmd) print "Image ". $details['name'] ." Thumbnails:";
 
          /* if the file hasn't changed there is no need to regen the thumb */
@@ -381,8 +387,14 @@ class PHPFSPOT {
          /* set the new/changed MD5 sum for the current photo */
          $this->setMD5($photo, $file_md5);
 
+         $resolutions = Array(
+                           $this->cfg->thumb_width,
+                           $this->cfg->bubble_width,
+                           $this->cfg->photo_width
+                        );
+
          /* create thumbnails for the requested resolutions */
-         foreach(Array($this->cfg->thumb_width, $this->cfg->photo_width) as $resolution) {
+         foreach($resolutions as $resolution) {
             if($fromcmd) print " ". $resolution ."px";
             $this->create_thumbnail($full_path, $resolution);
          }