| Conditions | 5 |
| Paths | 4 |
| Total Lines | 31 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function fetchSize($images) {
|
||
| 36 | |||
| 37 | if (empty($images)) |
||
| 38 | {
|
||
| 39 | return []; |
||
| 40 | } |
||
| 41 | |||
| 42 | $configArray = Yaml::parse(file_get_contents($this->pathToYml)); |
||
| 43 | $minSize = $configArray['image_size']['minimum']; |
||
| 44 | $maxSize = $configArray['image_size']['maximum']; |
||
| 45 | |||
| 46 | $imageList = array(); |
||
| 47 | |||
| 48 | foreach ($images as $key => $image) {
|
||
| 49 | $imageList[$key]['url'] = $image; |
||
| 50 | $imageList[$key]['size'] = ImageUtility::getSize($image); |
||
| 51 | |||
| 52 | list($width, $height) = getimagesize($image); |
||
| 53 | $imageList[$key]['height'] = $height; |
||
| 54 | $imageList[$key]['width'] = $width; |
||
| 55 | |||
| 56 | $imageList[$key]['valid'] = true; |
||
| 57 | |||
| 58 | if ($imageList[$key]['size'] < $minSize || $imageList[$key]['size'] > $maxSize) |
||
| 59 | {
|
||
| 60 | $imageList[$key]['valid'] = false; |
||
| 61 | } |
||
| 62 | } |
||
| 63 | |||
| 64 | return $imageList; |
||
| 65 | } |
||
| 66 | |||
| 68 |