Code Duplication    Length = 11-11 lines in 2 locations

class/pictures.php 2 locations

@@ 568-578 (lines=11) @@
565
        $img    = imagecreatefromjpeg($img);
566
        $xratio = $thumbwidth / imagesx($img);
567
        $yratio = $thumbheight / imagesy($img);
568
        if ($xratio < 1 || $yratio < 1) {
569
            if ($xratio < $yratio) {
570
                $resized = imagecreatetruecolor($thumbwidth, floor(imagesy($img) * $xratio));
571
            } else {
572
                $resized = imagecreatetruecolor(floor(imagesx($img) * $yratio), $thumbheight);
573
            }
574
            imagecopyresampled($resized, $img, 0, 0, 0, 0, imagesx($resized) + 1, imagesy($resized) + 1, imagesx($img), imagesy($img));
575
            imagejpeg($resized, $path_upload . '/thumbs/thumb_' . $path['basename']);
576
            imagedestroy($resized);
577
        } else {
578
            imagejpeg($img, $path_upload . '/thumbs/thumb_' . $path['basename']);
579
        }
580
        imagedestroy($img);
581
        $path2   = pathinfo($img2);
@@ 585-595 (lines=11) @@
582
        $img2    = imagecreatefromjpeg($img2);
583
        $xratio2 = $pictwidth / imagesx($img2);
584
        $yratio2 = $pictheight / imagesy($img2);
585
        if ($xratio2 < 1 || $yratio2 < 1) {
586
            if ($xratio2 < $yratio2) {
587
                $resized2 = imagecreatetruecolor($pictwidth, floor(imagesy($img2) * $xratio2));
588
            } else {
589
                $resized2 = imagecreatetruecolor(floor(imagesx($img2) * $yratio2), $pictheight);
590
            }
591
            imagecopyresampled($resized2, $img2, 0, 0, 0, 0, imagesx($resized2) + 1, imagesy($resized2) + 1, imagesx($img2), imagesy($img2));
592
            imagejpeg($resized2, $path_upload . '/midsize/resized_' . $path2['basename']);
593
            imagedestroy($resized2);
594
        } else {
595
            imagejpeg($img2, $path_upload . '/midsize/resized_' . $path2['basename']);
596
        }
597
        imagedestroy($img2);
598
    }