Updates Thumb to use defined paths.

This commit is contained in:
Lars Jung 2012-08-13 21:34:06 +02:00
parent 09abaa9a3c
commit 1458623998
2 changed files with 23 additions and 17 deletions

View File

@ -86,19 +86,6 @@ class H5ai {
}
public function getCacheAbsPath() {
return $this->h5aiAbsPath . '/cache';
}
public function getTempAbsPath() {
// return H5ai::normalize_path(sys_get_temp_dir());
return $this->h5aiAbsPath . '/cache';
}
public function getRootAbsHref() {
return $this->rootAbsHref;
@ -111,6 +98,25 @@ class H5ai {
}
public function getCacheAbsPath() {
return $this->h5aiAbsPath . '/cache';
}
public function getCacheAbsHref() {
return $this->h5aiAbsHref . 'cache/';
}
public function getTempAbsPath() {
// return H5ai::normalize_path(sys_get_temp_dir());
return $this->h5aiAbsPath . '/cache';
}
public function getOptions() {
return $this->options;

View File

@ -47,10 +47,10 @@ class Thumb {
return null;
}
$name = "cache/thumb-" . sha1("$sourceAbsPath-$width-$height-$mode") . ".jpg";
// $name = "cache/thumb-" . sha1("$sourceAbsPath-$width-$height-$mode") . ".png";
$thumbAbsHref = $this->h5ai->getH5aiAbsHref() . $name;
$thumbAbsPath = $this->h5ai->getH5aiAbsPath() . "/" . $name;
$name = "thumb-" . sha1("$sourceAbsPath-$width-$height-$mode") . ".jpg";
// $name = "thumb-" . sha1("$sourceAbsPath-$width-$height-$mode") . ".png";
$thumbAbsPath = $this->h5ai->getCacheAbsPath() . "/" . $name;
$thumbAbsHref = $this->h5ai->getCacheAbsHref() . $name;
if (!file_exists($thumbAbsPath) || filemtime($sourceAbsPath) >= filemtime($thumbAbsPath)) {
$image = new Image();