diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-05-20 06:58:47 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-05-20 06:58:47 +0000 |
commit | 2e204cac78c067a45013d79dc8450ff49d52c31a (patch) | |
tree | ff97365704017023479ee0c0b45125a4b38ccac1 /core | |
parent | 774e0b3737d51b70bb141f4e13c6c111208847c0 (diff) |
Add a cache buster to thumbnail urls, using the item update time.
Fixes ticket #121.
Diffstat (limited to 'core')
-rw-r--r-- | core/models/item.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/models/item.php b/core/models/item.php index 8ad22721..4b8cac8e 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -247,16 +247,18 @@ class Item_Model extends ORM_MPTT { * photo: http://example.com/gallery3/var/albums/album1/photo.thumb.jpg */ public function thumb_url($full_uri=false) { + $cache_buster = "?m=" . $this->updated; $base = ($full_uri ? url::abs_file("var/thumbs/" . $this->relative_path()) : url::file("var/thumbs/" . $this->relative_path())); if ($this->is_photo()) { - return $base; + return $base . $cache_buster; } else if ($this->is_album()) { - return $base . "/.album.jpg"; + return $base . "/.album.jpg" . $cache_buster; } else if ($this->is_movie()) { // Replace the extension with jpg - return preg_replace("/...$/", "jpg", $base); + $base = preg_replace("/...$/", "jpg", $base); + return $base . $cache_buster; } } |