X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.class.php;h=723140f0ef5ab4b5ee0e5b11e65fbc641812e074;hp=087d82f8783d02f75586eca54b797b6a65ac668e;hb=4ff4a0e7adc87e654f6eefccdd2f43827bd06535;hpb=e785e025945eed31e47c504bb213b4150a755fbf diff --git a/phpfspot.class.php b/phpfspot.class.php index 087d82f..723140f 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -115,10 +115,10 @@ class PHPFSPOT { $_SESSION['selected_tags'] = $this->extractTags($_GET['tags']); } if(isset($_GET['from_date']) && $this->isValidDate($_GET['from_date'])) { - $_SESSION['from_date'] = strtotime($_GET['from_date']); + $_SESSION['from_date'] = strtotime($_GET['from_date'] ." 00:00:00"); } if(isset($_GET['to_date']) && $this->isValidDate($_GET['to_date'])) { - $_SESSION['to_date'] = strtotime($_GET['to_date']); + $_SESSION['to_date'] = strtotime($_GET['to_date'] ." 23:59:59"); } break; case 'showp': @@ -292,7 +292,7 @@ class PHPFSPOT { } $orig_path = $this->translate_path($details['directory_path']) ."/". $details['name']; - $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->photo_width ."_". $this->getMD5($photo); + $thumb_path = $this->get_thumb_path($this->cfg->photo_width, $photo); if(!file_exists($orig_path)) { $this->_error("Photo ". $orig_path ." does not exist!
\n"); @@ -305,7 +305,7 @@ class PHPFSPOT { /* If the thumbnail doesn't exist yet, try to create it */ if(!file_exists($thumb_path)) { $this->gen_thumb($photo, true); - $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->photo_width ."_". $this->getMD5($photo); + $thumb_path = $this->get_thumb_path($this->cfg->photo_width, $photo); } /* get f-spot database meta information */ @@ -755,7 +755,7 @@ class PHPFSPOT { $img_name[$rows][$cols] = htmlspecialchars($this->getPhotoName($photos[$i], 15)); $img_title[$rows][$cols] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0)); - $thumb_path = $this->cfg->base_path ."/thumbs/". $this->cfg->thumb_width ."_". $this->getMD5($photos[$i]); + $thumb_path = $this->get_thumb_path($this->cfg->thumb_width, $photos[$i]); if(file_exists($thumb_path)) { $info = getimagesize($thumb_path); @@ -1129,7 +1129,12 @@ class PHPFSPOT { foreach($resolutions as $resolution) { - $thumb_path = $this->cfg->base_path ."/thumbs/". $resolution ."_". $file_md5; + $thumb_sub_path = substr($file_md5, 0, 2); + $thumb_path = $this->cfg->base_path ."/thumbs/". $thumb_sub_path ."/". $resolution ."_". $file_md5; + + if(!file_exists(dirname($thumb_path))) { + mkdir(dirname($thumb_path), 0755); + } /* if the thumbnail file doesn't exist, create it */ if(!file_exists($thumb_path)) { @@ -1442,9 +1447,9 @@ class PHPFSPOT { */ private function get_calendar($mode) { - $year = $_SESSION[$mode .'_date'] ? date("Y", strtotime($_SESSION[$mode .'_date'])) : date("Y"); - $month = $_SESSION[$mode .'_date'] ? date("m", strtotime($_SESSION[$mode .'_date'])) : date("m"); - $day = $_SESSION[$mode .'_date'] ? date("d", strtotime($_SESSION[$mode .'_date'])) : date("d"); + $year = $_SESSION[$mode .'_date'] ? date("Y", $_SESSION[$mode .'_date']) : date("Y"); + $month = $_SESSION[$mode .'_date'] ? date("m", $_SESSION[$mode .'_date']) : date("m"); + $day = $_SESSION[$mode .'_date'] ? date("d", $_SESSION[$mode .'_date']) : date("d"); $output = "getMD5($photo), 0, 2); + return $this->cfg->base_path + . "/thumbs/" + . $sub_path + . "/" + . $width + . "_" + . $this->getMD5($photo); + + } // get_thumb_path() + } ?>