var $db;
var $parent;
+ /**
+ * PHPFSPOT_IMG class constructor
+ */
public function __construct()
{
$this->parent = new PHPFSPOT;
} // __construct()
+ /**
+ * PHPFSPOT_IMG class destructor
+ */
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)
{
+ if($idx == 'rand')
+ $idx = $this->parent->get_random_photo();
+
$details = $this->parent->get_photo_details($idx);
if(!$details) {
- $this->parent->showTextImage("The image you requested is unknown");
+ $this->parent->showTextImage("The image (". $idx .") you requested is unknown");
return;
}
Header("Content-Disposition: inline; filename=\"". $details['name'] ."\"");
Header("Accept-Ranges: bytes");
Header("Connection: close");
-
+ Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+ Header("Cache-Control: no-cache");
+ Header("Pragma: no-cache");
+
$file = fopen($fullpath, "rb");
fpassthru($file);
@fclose($file);
}
-if(isset($_GET['idx']) && is_numeric($_GET['idx'])) {
+if(isset($_GET['idx']) && (is_numeric($_GET['idx']) || $_GET['idx'] == 'rand')) {
$img = new PHPFSPOT_IMG;