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 $details = $this->parent->get_photo_details($idx);
27 $this->parent->showTextImage("The image you requested is unknown");
31 /* show original photo */
33 $fullpath = $this->parent->translate_path($details['directory_path']) ."/". $details['name'];
37 $fullpath = $this->parent->cfg->base_path ."/thumbs/". $width ."_". $this->parent->getMD5($idx);
38 if(!file_exists($fullpath))
39 $this->parent->gen_thumb($idx, 0, 1);
42 if(!file_exists($fullpath)) {
43 $this->parent->showTextImage("File ". $fullpath ." does not exist");
46 if(!is_readable($fullpath)) {
47 $this->parent->showTextImage("File ". $fullpath ." is not readable. Check the permissions");
51 $tmp = getimagesize($fullpath);
54 if(!$this->parent->checkifImageSupported($mime)) {
55 $this->parent->showTextImage("Unsupported Image Type");
59 Header("Content-Type: ". $mime);
60 Header("Content-Length: ". filesize($fullpath));
61 Header("Content-Transfer-Encoding: binary\n");
62 Header("Content-Disposition: inline; filename=\"". $details['name'] ."\"");
63 Header("Accept-Ranges: bytes");
64 Header("Connection: close");
66 $file = fopen($fullpath, "rb");
74 if(isset($_GET['idx']) && is_numeric($_GET['idx'])) {
76 if(isset($_GET['width']) && is_numeric($_GET['width']))
77 $width = $_GET['width'];
81 $img = new PHPFSPOT_IMG;
82 $img->show($_GET['idx'], $width);