summaryrefslogtreecommitdiff
path: root/core/models
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-02-25 05:27:29 +0000
committerBharat Mediratta <bharat@menalto.com>2009-02-25 05:27:29 +0000
commit515c081f794c0e020241956f291381361e28489a (patch)
tree3c1f4a153d046db9f3a4a39df4954bbc33a227f1 /core/models
parent585ea819579405bbfe772d2e7fa647f54d5a17e2 (diff)
Add support MP4 movies also. Flowplayer supports them and can stream
them using the h264streaming plugin. Everything else is a fairly minor change.
Diffstat (limited to 'core/models')
-rw-r--r--core/models/item.php26
1 files changed, 20 insertions, 6 deletions
diff --git a/core/models/item.php b/core/models/item.php
index 329f9c43..cc242abf 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -180,8 +180,15 @@ class Item_Model extends ORM_MPTT {
* photo: /var/albums/album1/photo.thumb.jpg
*/
public function thumb_path() {
- return VARPATH . "thumbs/" . $this->relative_path() .
- ($this->is_album() ? "/.album.jpg" : "");
+ $base = VARPATH . "thumbs/" . $this->relative_path();
+ if ($this->is_photo()) {
+ return $base;
+ } else if ($this->is_album()) {
+ return $base . "/.album.jpg";
+ } else if ($this->is_movie()) {
+ // Replace the extension with jpg
+ return preg_replace("/...$/", "jpg", $base);
+ }
}
/**
@@ -189,10 +196,17 @@ class Item_Model extends ORM_MPTT {
* photo: http://example.com/gallery3/var/albums/album1/photo.thumb.jpg
*/
public function thumb_url($full_uri=true) {
- return ($full_uri ?
- url::abs_file("var/thumbs/" . $this->relative_path()) :
- url::file("var/thumbs/" . $this->relative_path())) .
- ($this->is_album() ? "/.album.jpg" : "");
+ $base = ($full_uri ?
+ url::abs_file("var/thumbs/" . $this->relative_path()) :
+ url::file("var/thumbs/" . $this->relative_path()));
+ if ($this->is_photo()) {
+ return $base;
+ } else if ($this->is_album()) {
+ return $base . "/.album.jpg";
+ } else if ($this->is_movie()) {
+ // Replace the extension with jpg
+ return preg_replace("/...$/", "jpg", $base);
+ }
}
/**