@@ -94,8 +94,7 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * @param array $_files represents the $_FILES array passed as dependency |
96 | 96 | */ |
97 | - public function __construct(array $_files = array()) |
|
98 | - { |
|
97 | + public function __construct(array $_files = array()) { |
|
99 | 98 | /* check if php_exif is enabled */ |
100 | 99 | if (!function_exists('exif_imagetype')) { |
101 | 100 | $this->error = 'Function \'exif_imagetype\' Not found. Please enable \'php_exif\' in your PHP.ini'; |
@@ -131,8 +130,7 @@ discard block |
||
131 | 130 | * |
132 | 131 | * @return string|boolean |
133 | 132 | */ |
134 | - public function offsetGet($offset) |
|
135 | - { |
|
133 | + public function offsetGet($offset) { |
|
136 | 134 | // return error if requested |
137 | 135 | if ($offset == 'error') { |
138 | 136 | return $this->error; |
@@ -161,8 +159,7 @@ discard block |
||
161 | 159 | * |
162 | 160 | * @return $this |
163 | 161 | */ |
164 | - public function setDimension($maxWidth, $maxHeight) |
|
165 | - { |
|
162 | + public function setDimension($maxWidth, $maxHeight) { |
|
166 | 163 | $this->dimensions = array($maxWidth, $maxHeight); |
167 | 164 | return $this; |
168 | 165 | } |
@@ -172,8 +169,7 @@ discard block |
||
172 | 169 | * |
173 | 170 | * @return string |
174 | 171 | */ |
175 | - public function getFullPath() |
|
176 | - { |
|
172 | + public function getFullPath() { |
|
177 | 173 | $this->fullPath = $this->location . '/' . $this->name . '.' . $this->mime; |
178 | 174 | return $this->fullPath; |
179 | 175 | } |
@@ -183,8 +179,7 @@ discard block |
||
183 | 179 | * |
184 | 180 | * @return int |
185 | 181 | */ |
186 | - public function getSize() |
|
187 | - { |
|
182 | + public function getSize() { |
|
188 | 183 | return (int) $this->_files['size']; |
189 | 184 | } |
190 | 185 | |
@@ -196,8 +191,7 @@ discard block |
||
196 | 191 | * |
197 | 192 | * @return $this |
198 | 193 | */ |
199 | - public function setSize($min, $max) |
|
200 | - { |
|
194 | + public function setSize($min, $max) { |
|
201 | 195 | $this->size = array($min, $max); |
202 | 196 | return $this; |
203 | 197 | } |
@@ -207,8 +201,7 @@ discard block |
||
207 | 201 | * |
208 | 202 | * @return string |
209 | 203 | */ |
210 | - public function getJson() |
|
211 | - { |
|
204 | + public function getJson() { |
|
212 | 205 | /* gather image info for json storage */ |
213 | 206 | return json_encode ( |
214 | 207 | array( |
@@ -228,8 +221,7 @@ discard block |
||
228 | 221 | * |
229 | 222 | * @return null|string |
230 | 223 | */ |
231 | - public function getMime() |
|
232 | - { |
|
224 | + public function getMime() { |
|
233 | 225 | if (!$this->mime) { |
234 | 226 | return $this->getImageMime($this->_files['tmp_name']); |
235 | 227 | } |
@@ -243,8 +235,7 @@ discard block |
||
243 | 235 | * |
244 | 236 | * @return $this |
245 | 237 | */ |
246 | - public function setMime(array $fileTypes) |
|
247 | - { |
|
238 | + public function setMime(array $fileTypes) { |
|
248 | 239 | $this->mimeTypes = $fileTypes; |
249 | 240 | return $this; |
250 | 241 | } |
@@ -256,8 +247,7 @@ discard block |
||
256 | 247 | * |
257 | 248 | * @return null|string |
258 | 249 | */ |
259 | - protected function getImageMime($tmp_name) |
|
260 | - { |
|
250 | + protected function getImageMime($tmp_name) { |
|
261 | 251 | $mime = @ $this->acceptedMimes[exif_imagetype($tmp_name)]; |
262 | 252 | |
263 | 253 | if (!$mime) { |
@@ -272,8 +262,7 @@ discard block |
||
272 | 262 | * |
273 | 263 | * @return string|false |
274 | 264 | */ |
275 | - public function getError() |
|
276 | - { |
|
265 | + public function getError() { |
|
277 | 266 | return $this->error != '' ? $this->error : false; |
278 | 267 | } |
279 | 268 | |
@@ -282,8 +271,7 @@ discard block |
||
282 | 271 | * |
283 | 272 | * @return string |
284 | 273 | */ |
285 | - public function getName() |
|
286 | - { |
|
274 | + public function getName() { |
|
287 | 275 | if (!$this->name) { |
288 | 276 | return uniqid('', true) . '_' . str_shuffle(implode(range('e', 'q'))); |
289 | 277 | } |
@@ -297,8 +285,7 @@ discard block |
||
297 | 285 | * @param null $isNameProvided |
298 | 286 | * @return $this |
299 | 287 | */ |
300 | - public function setName($isNameProvided = null) |
|
301 | - { |
|
288 | + public function setName($isNameProvided = null) { |
|
302 | 289 | if ($isNameProvided) { |
303 | 290 | $this->name = filter_var($isNameProvided, FILTER_SANITIZE_STRING); |
304 | 291 | } |
@@ -311,8 +298,7 @@ discard block |
||
311 | 298 | * |
312 | 299 | * @return int |
313 | 300 | */ |
314 | - public function getWidth() |
|
315 | - { |
|
301 | + public function getWidth() { |
|
316 | 302 | if ($this->width != null) { |
317 | 303 | return $this->width; |
318 | 304 | } |
@@ -326,8 +312,7 @@ discard block |
||
326 | 312 | * |
327 | 313 | * @return int |
328 | 314 | */ |
329 | - public function getHeight() |
|
330 | - { |
|
315 | + public function getHeight() { |
|
331 | 316 | if ($this->height != null) { |
332 | 317 | return $this->height; |
333 | 318 | } |
@@ -341,8 +326,7 @@ discard block |
||
341 | 326 | * |
342 | 327 | * @return string |
343 | 328 | */ |
344 | - public function getLocation() |
|
345 | - { |
|
329 | + public function getLocation() { |
|
346 | 330 | if (!$this->location) { |
347 | 331 | $this->setLocation(); |
348 | 332 | } |
@@ -358,8 +342,7 @@ discard block |
||
358 | 342 | * |
359 | 343 | * @return $this |
360 | 344 | */ |
361 | - public function setLocation($dir = 'bulletproof', $permission = 0666) |
|
362 | - { |
|
345 | + public function setLocation($dir = 'bulletproof', $permission = 0666) { |
|
363 | 346 | if (!file_exists($dir) && !is_dir($dir)) { |
364 | 347 | $createFolder = @mkdir('' . $dir, (int) $permission, true); |
365 | 348 | if (!$createFolder) { |
@@ -382,8 +365,7 @@ discard block |
||
382 | 365 | * This methods validates and uploads the image |
383 | 366 | * @return false|Image |
384 | 367 | */ |
385 | - public function upload() |
|
386 | - { |
|
368 | + public function upload() { |
|
387 | 369 | /* modify variable names for convenience */ |
388 | 370 | $image = $this; |
389 | 371 | $files = $this->_files; |
@@ -453,8 +435,7 @@ discard block |
||
453 | 435 | * |
454 | 436 | * @return bool |
455 | 437 | */ |
456 | - public function moveUploadedFile($tmp_name, $destination) |
|
457 | - { |
|
438 | + public function moveUploadedFile($tmp_name, $destination) { |
|
458 | 439 | return move_uploaded_file($tmp_name, $destination); |
459 | 440 | } |
460 | 441 | } |
461 | 442 | \ No newline at end of file |