diff options
author | Anika Henke <anika@selfthinker.org> | 2013-08-02 23:53:28 +0100 |
---|---|---|
committer | Anika Henke <anika@selfthinker.org> | 2013-08-02 23:53:28 +0100 |
commit | 99f943f68e3a6bd43d9b5b90f39e058ee2acfa9d (patch) | |
tree | 258b4b1e8535a9b9033072faa9b97f6f7fee287d /inc/media.php | |
parent | 3d7a9e0a1cba0b173b6b03f5c88a8eb975286cc7 (diff) | |
download | rpg-99f943f68e3a6bd43d9b5b90f39e058ee2acfa9d.tar.gz rpg-99f943f68e3a6bd43d9b5b90f39e058ee2acfa9d.tar.bz2 |
added poster attribute to video if jpg or png with same file name exists
Diffstat (limited to 'inc/media.php')
-rw-r--r-- | inc/media.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/inc/media.php b/inc/media.php index c1dafe2a3..6d0615a3c 100644 --- a/inc/media.php +++ b/inc/media.php @@ -2136,12 +2136,13 @@ function media_resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h,$ofs_x= * Return other media files with the same base name * but a different extension. * - * @param string $src - ID of media file - * @param array $exts - alternative extensions to find other files for + * @param string $src - ID of media file + * @param array $exts - alternative extensions to find other files for + * @param boolean $onlyone - set if only one result should be returned (and not the original) * * @author Anika Henke <anika@selfthinker.org> */ -function media_alternativefiles($src, $exts){ +function media_alternativefiles($src, $exts, $onlyone=false){ $files = array(); list($srcExt, $srcMime) = mimetype($src); @@ -2152,10 +2153,13 @@ function media_alternativefiles($src, $exts){ $file = mediaFN($fileid); if(file_exists($file)) { $files[$ext] = $fileid; + if ($onlyone) { + return $files; + } } } // if original wasn't any of $exts, return only original - if (empty($files)) { + if (empty($files) && !$onlyone) { $files[$srcExt] = $src; } return $files; |