Code Duplication    Length = 12-12 lines in 2 locations

class/pictures.php 2 locations

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