1 | <?php |
||
7 | class MediaFile |
||
8 | { |
||
9 | protected $id; |
||
10 | protected $path; |
||
11 | |||
12 | protected $mime; |
||
13 | protected $ext; |
||
14 | protected $downloadable; |
||
15 | |||
16 | protected $width; |
||
17 | protected $height; |
||
18 | protected $meta; |
||
19 | |||
20 | /** |
||
21 | * MediaFile constructor. |
||
22 | * @param string $id |
||
23 | * @param string|int $rev optional revision |
||
24 | */ |
||
25 | public function __construct($id, $rev = '') |
||
32 | |||
33 | /** |
||
34 | * Factory to create a new MediaFile from a Media Path |
||
35 | * |
||
36 | * @param string $path The path of a file, relative to the media base dir |
||
37 | * @return MediaFile |
||
38 | */ |
||
39 | static public function fromRelativePath($path) |
||
47 | |||
48 | /** @return string */ |
||
49 | public function getId() |
||
53 | |||
54 | /** @return string */ |
||
55 | public function getPath() |
||
59 | |||
60 | /** |
||
61 | * The ID without namespace, used for display purposes |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | public function getDisplayName() |
||
69 | |||
70 | /** @return string */ |
||
71 | public function getMime() |
||
76 | |||
77 | /** @return string */ |
||
78 | public function getExtension() |
||
82 | |||
83 | /** |
||
84 | * Similar to the extesion but does some clean up |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getIcoClass() |
||
94 | |||
95 | /** |
||
96 | * Should this file be downloaded instead being displayed inline? |
||
97 | * |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function isDownloadable() |
||
104 | |||
105 | /** @return int */ |
||
106 | public function getFileSize() |
||
110 | |||
111 | /** @return int */ |
||
112 | public function getLastModified() |
||
116 | |||
117 | /** @return bool */ |
||
118 | public function isWritable() |
||
122 | |||
123 | /** @return bool */ |
||
124 | public function isImage() |
||
128 | |||
129 | /** |
||
130 | * initializes width and height for images when requested |
||
131 | */ |
||
132 | protected function initSizes() |
||
141 | |||
142 | /** |
||
143 | * Returns the width if this is a supported image, 0 otherwise |
||
144 | * |
||
145 | * @return int |
||
146 | */ |
||
147 | public function getWidth() |
||
152 | |||
153 | /** |
||
154 | * Returns the height if this is a supported image, 0 otherwise |
||
155 | * |
||
156 | * @return int |
||
157 | */ |
||
158 | public function getHeight() |
||
163 | |||
164 | /** @return \JpegMeta */ |
||
165 | public function getMeta() |
||
170 | } |
||
171 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.