diff options
author | patdenice <patdenice@piwigo.org> | 2012-02-29 21:21:46 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2012-02-29 21:21:46 +0000 |
commit | c0bdb8a765065429193d2d78a707031451d4abab (patch) | |
tree | 2cf369b31e60127e7c1b325368d95523c74b01d4 /include/derivative.inc.php | |
parent | ce06fe8a489aea7ac2e2e67f36242784e919da06 (diff) |
Multisize
Load thumbnails with ajax.
git-svn-id: http://piwigo.org/svn/trunk@13444 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/derivative.inc.php')
-rw-r--r-- | include/derivative.inc.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/derivative.inc.php b/include/derivative.inc.php index 844d93911..2fc536475 100644 --- a/include/derivative.inc.php +++ b/include/derivative.inc.php @@ -99,7 +99,7 @@ final class DerivativeImage public $src_image; private $params; - private $rel_path, $rel_url; + private $rel_path, $rel_url, $is_cached; function __construct($type, $src_image) { @@ -113,7 +113,7 @@ final class DerivativeImage $this->params = $type; } - self::build($src_image, $this->params, $this->rel_path, $this->rel_url); + self::build($src_image, $this->params, $this->rel_path, $this->rel_url, $this->is_cached); } static function thumb_url($infos) @@ -153,13 +153,14 @@ final class DerivativeImage return $ret; } - private static function build($src, &$params, &$rel_path, &$rel_url) + private static function build($src, &$params, &$rel_path, &$rel_url, &$is_cached=null) { if ( $src->has_size() && $params->is_identity( $src->get_size() ) ) { // todo - what if we have a watermark maybe return a smaller size? $params = null; $rel_path = $rel_url = $src->rel_path; + $is_cached = true; return; } @@ -191,10 +192,12 @@ final class DerivativeImage $mtime = @filemtime(PHPWG_ROOT_PATH.$rel_path); if ($mtime===false or $mtime < $params->last_mod_time) { + $is_cached = false; $url_style = 2; } else { + $is_cached = true; $url_style = 1; } } @@ -303,6 +306,11 @@ final class DerivativeImage return 'width="'.$size[0].'" height="'.$size[1].'"'; } } + + function is_cached() + { + return $this->is_cached; + } } ?>
\ No newline at end of file |