Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | protected function calculateSize(int $currentWidth, int $maxWidth, int $currentHeight, int $maxHeight): array |
||
21 | { |
||
22 | $newWidth = $currentWidth / $maxWidth; |
||
23 | $newHeight = $currentHeight / $maxHeight; |
||
24 | $ratio = max($newWidth, $newHeight); // due this it's necessary to pass all |
||
25 | $ratio = max($ratio, 1.0); |
||
26 | $newWidth = (int) ($currentWidth / $ratio); |
||
27 | $newHeight = (int) ($currentHeight / $ratio); |
||
28 | return ['width' => $newWidth, 'height' => $newHeight]; |
||
29 | } |
||
31 |