Code Duplication    Length = 11-11 lines in 2 locations

class/pictures.php 2 locations

@@ 549-559 (lines=11) @@
546
        $img    = imagecreatefromjpeg($img);
547
        $xratio = $thumbwidth / imagesx($img);
548
        $yratio = $thumbheight / imagesy($img);
549
        if ($xratio < 1 || $yratio < 1) {
550
            if ($xratio < $yratio) {
551
                $resized = imagecreatetruecolor($thumbwidth, floor(imagesy($img) * $xratio));
552
            } else {
553
                $resized = imagecreatetruecolor(floor(imagesx($img) * $yratio), $thumbheight);
554
            }
555
            imagecopyresampled($resized, $img, 0, 0, 0, 0, imagesx($resized) + 1, imagesy($resized) + 1, imagesx($img), imagesy($img));
556
            imagejpeg($resized, $path_upload . '/thumbs/thumb_' . $path['basename']);
557
            imagedestroy($resized);
558
        } else {
559
            imagejpeg($img, $path_upload . '/thumbs/thumb_' . $path['basename']);
560
        }
561
        imagedestroy($img);
562
        $path2   = pathinfo($img2);
@@ 566-576 (lines=11) @@
563
        $img2    = imagecreatefromjpeg($img2);
564
        $xratio2 = $pictwidth / imagesx($img2);
565
        $yratio2 = $pictheight / imagesy($img2);
566
        if ($xratio2 < 1 || $yratio2 < 1) {
567
            if ($xratio2 < $yratio2) {
568
                $resized2 = imagecreatetruecolor($pictwidth, floor(imagesy($img2) * $xratio2));
569
            } else {
570
                $resized2 = imagecreatetruecolor(floor(imagesx($img2) * $yratio2), $pictheight);
571
            }
572
            imagecopyresampled($resized2, $img2, 0, 0, 0, 0, imagesx($resized2) + 1, imagesy($resized2) + 1, imagesx($img2), imagesy($img2));
573
            imagejpeg($resized2, $path_upload . '/midsize/resized_' . $path2['basename']);
574
            imagedestroy($resized2);
575
        } else {
576
            imagejpeg($img2, $path_upload . '/midsize/resized_' . $path2['basename']);
577
        }
578
        imagedestroy($img2);
579
    }