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);
28 /* show original photo */
30 $fullpath = $this->parent->translate_path($details['directory_path']) ."/". $details['name'];
34 $fullpath = $this->parent->cfg->base_path ."/thumbs/". $width ."_". $this->parent->getMD5($idx);
37 if(!file_exists($fullpath)) {
38 $this->parent->gen_thumb($idx, 0, 1);
40 if(!is_readable($fullpath)) {
41 die("File ". $fullpath ." is not readable. Check the permissions");
44 $tmp = getimagesize($fullpath);
47 Header("Content-Type: ". $mime);
48 Header("Content-Length: ". filesize($fullpath));
49 Header("Content-Transfer-Encoding: binary\n");
50 Header("Content-Disposition: inline; filename=\"". $details['name'] ."\"");
51 Header("Accept-Ranges: bytes");
52 Header("Connection: close");
54 $file = fopen($fullpath, "rb");
62 if(isset($_GET['idx']) && is_numeric($_GET['idx'])) {
64 if(isset($_GET['width']) && is_numeric($_GET['width']))
65 $width = $_GET['width'];
69 $img = new PHPFSPOT_IMG;
70 $img->show($_GET['idx'], $width);