Code Duplication    Length = 4-5 lines in 3 locations

src/utils/func.image-resize.php 3 locations

@@ 18-22 (lines=5) @@
15
    $height = intval($newWidth / $imgWidth * $imgHeight);
16
17
    // If the height is too large, set it to the maximum height and calculate the width.
18
    if ($height > $newHeight) {
19
20
        $height = $newHeight;
21
        $newWidth = intval($height / $imgHeight * $imgWidth);
22
    }
23
24
    // If we don't allow upsizing check if the new width or height are too big.
25
    if (!$upsize) {
@@ 27-30 (lines=4) @@
24
    // If we don't allow upsizing check if the new width or height are too big.
25
    if (!$upsize) {
26
        // If the given width is larger then the image height, then resize it.
27
        if ($newWidth > $imgWidth) {
28
            $newWidth = $imgWidth;
29
            $height = intval($newWidth / $imgWidth * $imgHeight);
30
        }
31
32
        // If the given height is larger then the image height, then resize it.
33
        if ($height > $imgHeight) {
@@ 33-36 (lines=4) @@
30
        }
31
32
        // If the given height is larger then the image height, then resize it.
33
        if ($height > $imgHeight) {
34
            $height = $imgHeight;
35
            $newWidth = intval($height / $imgHeight * $imgWidth);
36
        }
37
    }
38
39
    if ($ratio == true)