3 require_once "phpfspot.class.php";
10 public function __construct()
12 $this->parent = new PHPFSPOT;
13 $this->db = $this->parent->db;
17 public function __destruct()
22 public function show($idx, $width = 0)
24 $this->parent->gen_thumb($idx);
26 $details = $this->parent->get_photo_details($idx);
29 $fullpath = $this->parent->translate_path($details['directory_path']) ."/". $details['name'];
32 $fullpath = $this->parent->translate_path($details['directory_path']) ."/thumbs/". $width ."_". $details['name'];
35 if(!file_exists($fullpath)) {
36 $this->parent->gen_thumb($idx, 0, 1);
38 if(!is_readable($fullpath)) {
39 die("File ". $fullpath ." is not readable. Check the permissions");
42 $tmp = getimagesize($fullpath);
45 Header("Content-Type: ". $mime);
46 Header("Content-Length: ". filesize($fullpath));
47 Header("Content-Transfer-Encoding: binary\n");
48 Header("Content-Disposition: inline; filename=\"". $details['name'] ."\"");
49 Header("Accept-Ranges: bytes");
50 Header("Connection: close");
52 $file = fopen($fullpath, "rb");
60 if(isset($_GET['idx']) && is_numeric($_GET['idx'])) {
62 if(isset($_GET['width']) && is_numeric($_GET['width']))
63 $width = $_GET['width'];
67 $img = new PHPFSPOT_IMG;
68 $img->show($_GET['idx'], $width);