From 2e204cac78c067a45013d79dc8450ff49d52c31a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 20 May 2009 06:58:47 +0000 Subject: Add a cache buster to thumbnail urls, using the item update time. Fixes ticket #121. --- core/models/item.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'core') 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; } } -- cgit v1.2.3