Code Duplication    Length = 15-18 lines in 2 locations

htdocs/image.php 2 locations

@@ 483-497 (lines=15) @@
480
        imagesavealpha($destination_image, true);
481
        $png_transparency = imagecolorallocatealpha($destination_image, 0, 0, 0, 127);
482
        imagefill($destination_image, 0, 0, $png_transparency);
483
    } else {
484
        // Fill the background with the specified color for matting purposes
485
        if ($color[0] === '#') {
486
            $color = substr($color, 1);
487
        }
488
        $background = false;
489
        if (strlen($color) == 6) {
490
            $background = imagecolorallocate(
491
                $destination_image,
492
                intval($color[0] . $color[1], 16),
493
                intval($color[2] . $color[3], 16),
494
                intval($color[4] . $color[5], 16)
495
            );
496
        } elseif (strlen($color) == 3) {
497
            $background = imagecolorallocate(
498
                $destination_image,
499
                intval($color[0] . $color[0], 16),
500
                intval($color[1] . $color[1], 16),
@@ 508-525 (lines=18) @@
505
            imagefill($destination_image, 0, 0, $background);
506
        }
507
    }
508
} else {
509
    if (!$color) {
510
        $color = DEFAULT_BACKGROUND_COLOR;
511
    }
512
    // Fill the background with the specified color for matting purposes
513
    if ($color[0] === '#') {
514
        $color = substr($color, 1);
515
    }
516
    $background = false;
517
    if (strlen($color) == 6) {
518
        $background = imagecolorallocate(
519
            $destination_image,
520
            intval($color[0] . $color[1], 16),
521
            intval($color[2] . $color[3], 16),
522
            intval($color[4] . $color[5], 16)
523
        );
524
    } elseif (strlen($color) == 3) {
525
        $background = imagecolorallocate(
526
            $destination_image,
527
            intval($color[0] . $color[0], 16),
528
            intval($color[1] . $color[1], 16),