summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-09-07 21:00:52 -0700
committerBharat Mediratta <bharat@menalto.com>2009-09-07 21:00:52 -0700
commitdccfce4c00024fa170a060b1c4b1d2bb227964ae (patch)
treeaaabe99db0409eb260bf8435474e492d3a5a3edb
parenta73b5e822684ae0138f3baa733b0013122b0368c (diff)
Correct a mental mistake in the prior change. All the xxx_url()
methods actually refer to the url to the file on disk, not the logical item. That's relative_url(). Perhaps some API renaming is in order?
-rw-r--r--modules/gallery/models/item.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index b679ebf1..ed1294e4 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -190,7 +190,7 @@ class Item_Model extends ORM_MPTT {
* photo: http://example.com/gallery3/var/albums/album1/photo.jpg
*/
public function file_url($full_uri=false) {
- $relative_url = "var/albums/" . $this->relative_url();
+ $relative_url = "var/albums/" . $this->relative_path();
return $full_uri ? url::abs_file($relative_url) : url::file($relative_url);
}
@@ -223,8 +223,8 @@ class Item_Model extends ORM_MPTT {
*/
public function thumb_url($full_uri=false) {
$cache_buster = "?m=" . $this->updated;
- $relative_url = "var/thumbs/" . $this->relative_url();
- $base = ($full_uri ? url::abs_file($relative_url) : url::file($relative_url));
+ $relative_path = "var/thumbs/" . $this->relative_path();
+ $base = ($full_uri ? url::abs_file($relative_path) : url::file($relative_path));
if ($this->is_photo()) {
return $base . $cache_buster;
} else if ($this->is_album()) {
@@ -250,8 +250,8 @@ class Item_Model extends ORM_MPTT {
* photo: http://example.com/gallery3/var/albums/album1/photo.resize.jpg
*/
public function resize_url($full_uri=false) {
- $relative_url = "var/resizes/" . $this->relative_url();
- return ($full_uri ? url::abs_file($relative_url) : url::file($relative_url)) .
+ $relative_path = "var/resizes/" . $this->relative_path();
+ return ($full_uri ? url::abs_file($relative_path) : url::file($relative_path)) .
($this->is_album() ? "/.album.jpg" : "");
}
@@ -329,9 +329,11 @@ class Item_Model extends ORM_MPTT {
*/
public function __set($column, $value) {
if ($column == "name") {
- // Clear the relative path as it is no longer valid. The relative url cache does not need
- // to be flushed because it's not tightly bound to the actual name of the file.
+ // Clear the relative path as it is no longer valid.
$this->relative_path_cache = null;
+ } else if ($column == "slug") {
+ // Clear the relative url as it is no longer valid.
+ $this->relative_url_cache = null;
}
parent::__set($column, $value);
}