Code Duplication    Length = 7-7 lines in 2 locations

admin/upload.php 1 location

@@ 75-81 (lines=7) @@
72
73
$img_ratio = $width / $height;
74
75
if ($target_ratio > $img_ratio) {
76
    $new_height = $target_height;
77
    $new_width  = $img_ratio * $target_height;
78
} else {
79
    $new_height = $target_width / $img_ratio;
80
    $new_width  = $target_width;
81
}
82
83
if ($new_height > $target_height) {
84
    $new_height = $target_height;

img.php 1 location

@@ 46-52 (lines=7) @@
43
$target_ratio = $target_width / $target_height;
44
$img_ratio    = $width / $height;
45
46
if ($target_ratio > $img_ratio) {
47
    $new_height = $target_height;
48
    $new_width  = $img_ratio * $target_height;
49
} else {
50
    $new_height = $target_width / $img_ratio;
51
    $new_width  = $target_width;
52
}
53
54
if ($new_height > $target_height) {
55
    $new_height = $target_height;