Code Duplication    Length = 4-5 lines in 3 locations

admin/upload.php 1 location

@@ 91-94 (lines=4) @@
88
}
89
90
$new_img = ImageCreateTrueColor(100, 100);
91
if (!@imagefilledrectangle($new_img, 0, 0, $target_width - 1, $target_height - 1, 0)) {    // Fill the image black
92
    echo _AM_MARTIN_ERROR_COULD_NOT_FILL_NEW_IMAGE;
93
    exit(0);
94
}
95
96
if (!@imagecopyresampled($new_img, $img, ($target_width - $new_width) / 2, ($target_height - $new_height) / 2, 0, 0, $new_width, $new_height, $width, $height)) {
97
    echo _AM_MARTIN_ERROR_COULD_NOT_RESIZE_IMAGE;

i.php 1 location

@@ 52-55 (lines=4) @@
49
$height = imageSY($img);
50
51
$new_img = ImageCreateTrueColor($width, $height);
52
if (!@imagefilledrectangle($new_img, 0, 0, $target_width - 1, $target_height - 1, 0)) {    // Fill the image black
53
    echo _AM_MARTIN_ERROR_COULD_NOT_FILL_NEW_IMAGE;
54
    exit(0);
55
}
56
57
if (!@imagecopyresampled($new_img, $img, 0, 0, 0, 0, $width, $height, $width, $height)) {
58
    echo _AM_MARTIN_ERROR_COULD_NOT_RESIZE_IMAGE;

img.php 1 location

@@ 62-66 (lines=5) @@
59
}
60
61
$new_img = ImageCreateTrueColor($target_width, $target_height);
62
if (!@imagefilledrectangle($new_img, 0, 0, $target_width - 1, $target_height - 1, 0)) {
63
    // Fill the image black
64
    echo _AM_MARTIN_ERROR_COULD_NOT_FILL_NEW_IMAGE;
65
    exit(0);
66
}
67
68
//if (!@imagecopyresampled($new_img, $img, ($target_width-$new_width)/2, ($target_height-$new_height)/2, 0, 0, $target_width, $target_height, $width, $height)) {
69
if (!@imagecopyresampled($new_img, $img, 0, 0, 0, 0, $target_width, $target_height, $width, $height)) {