From 515c081f794c0e020241956f291381361e28489a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 25 Feb 2009 05:27:29 +0000 Subject: Add support MP4 movies also. Flowplayer supports them and can stream them using the h264streaming plugin. Everything else is a fairly minor change. --- core/models/item.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'core/models') 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); + } } /** -- cgit v1.2.3