issue27, first trial of gallery export for HTML and MoinMoin markup
[phpfspot.git] / phpfspot.class.php
index 3a6a59082a7c04e6943d18fb265fad8497f02fd2..14dff99eb0ed67e4681e97651c4f4b652bbb8505 100644 (file)
@@ -64,6 +64,11 @@ class PHPFSPOT {
                $_SESSION['selected_tags'] = split(',', $_GET['tags']);
             }
             break;
+         case 'export':
+            $this->tmpl->show("export.tpl");
+            return;
+            break;
+
       }
 
       $this->tmpl->assign('content_page', 'welcome.tpl');
@@ -594,7 +599,10 @@ class PHPFSPOT {
          $extern_link.= "&tags=". $current_tags;
       }
 
+      $export_link = "index.php?mode=export";
+
       $this->tmpl->assign('extern_link', $extern_link);
+      $this->tmpl->assign('export_link', $export_link);
       $this->tmpl->assign('count', $count);
       $this->tmpl->assign('width', $this->cfg->thumb_width);
       $this->tmpl->assign('images', $images);
@@ -1129,6 +1137,37 @@ class PHPFSPOT {
 
    } // get_calendar()
 
+   public function getExport($mode)
+   {
+      $pictures = $this->getPhotoSelection();
+
+      if(!isset($_SERVER['HTTPS'])) $protocol = "http";
+      else $protocol = "https";
+
+      $server_name = $_SERVER['SERVER_NAME'];
+
+      foreach($pictures as $picture) {
+
+         $orig_url = $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->photo_width;
+         $thumb_url = $protocol ."://". $server_name . $this->cfg->web_path ."phpfspot_img.php?idx=". $picture ."&width=". $this->cfg->thumb_width;
+
+         switch($mode) {
+
+            case 'HTML':
+               // <a href="%pictureurl%"><img src="%thumbnailurl%" ></a>
+               print htmlspecialchars("<a href=\"". $orig_url ."\"><img src=\"". $thumb_url ."\" /></a>") ."<br />\n";
+               break;
+               
+            case 'MoinMoin':
+               // [%pictureurl% %thumbnailurl%]
+               print htmlspecialchars("[$orig_url $thumb_url]") ."<br />\n";
+               break;
+         }
+
+      }
+
+   } // getExport()
+
 }
 
 ?>