issue59, removed some unnecessary tables and placed <div> instead
[phpfspot.git] / phpfspot_img.php
index de677e558c56fe3ae76cbfcadd9d266520f17f11..a96d5e6f41c1d4ed86dd46933c36bdb9faf441e2 100644 (file)
@@ -1,5 +1,26 @@
 <?php
 
 <?php
 
+/***************************************************************************
+ *
+ * Copyright (c) by Andreas Unterkircher, unki@netshadow.at
+ * All rights reserved
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ***************************************************************************/
+
 require_once "phpfspot.class.php";
 
 class PHPFSPOT_IMG {
 require_once "phpfspot.class.php";
 
 class PHPFSPOT_IMG {
@@ -7,6 +28,9 @@ class PHPFSPOT_IMG {
    var $db;
    var $parent;
 
    var $db;
    var $parent;
 
+   /**
+    * PHPFSPOT_IMG class constructor
+    */
    public function __construct()
    {
       $this->parent = new PHPFSPOT;
    public function __construct()
    {
       $this->parent = new PHPFSPOT;
@@ -14,13 +38,27 @@ class PHPFSPOT_IMG {
 
    } // __construct()
 
 
    } // __construct()
 
+   /**
+    * PHPFSPOT_IMG class destructor
+    */
    public function __destruct()
    {
 
    } // __desctruct()
 
    public function __destruct()
    {
 
    } // __desctruct()
 
+   /**
+    * sends the specified image to the browser
+    *
+    * this function will send the specified image to 
+    * the client - in the specified width. it also try's
+    * to create on-the-fly missing thumbnails via PHPFSPOT
+    * gen_thumbs function.
+    */
    public function show($idx, $width = 0)
    {
    public function show($idx, $width = 0)
    {
+      if($idx == 'rand')
+         $idx = $this->parent->get_random_photo();
+
       $details = $this->parent->get_photo_details($idx);
    
       if(!$details) {
       $details = $this->parent->get_photo_details($idx);
    
       if(!$details) {
@@ -77,7 +115,7 @@ class PHPFSPOT_IMG {
 
 }
 
 
 }
 
-if(isset($_GET['idx']) && is_numeric($_GET['idx'])) {
+if(isset($_GET['idx']) && (is_numeric($_GET['idx']) || $_GET['idx'] == 'rand')) {
 
    $img = new PHPFSPOT_IMG;
 
 
    $img = new PHPFSPOT_IMG;