Code Duplication    Length = 12-12 lines in 2 locations

class/pictures.php 2 locations

@@ 537-548 (lines=12) @@
534
        $img    = imagecreatefromjpeg($img);
535
        $xratio = $thumbwidth / imagesx($img);
536
        $yratio = $thumbheight / imagesy($img);
537
        if ($xratio < 1 || $yratio < 1) {
538
            if ($xratio < $yratio) {
539
                $resized = imagecreatetruecolor($thumbwidth, floor(imagesy($img) * $xratio));
540
            } else {
541
                $resized = imagecreatetruecolor(floor(imagesx($img) * $yratio), $thumbheight);
542
            }
543
            imagecopyresampled($resized, $img, 0, 0, 0, 0, imagesx($resized) + 1, imagesy($resized) + 1, imagesx($img), imagesy($img));
544
            imagejpeg($resized, "{$path_upload}/thumbs/thumb_{$path['basename']}");
545
            imagedestroy($resized);
546
        } else {
547
            imagejpeg($img, "{$path_upload}/thumbs/thumb_{$path['basename']}");
548
        }
549
        imagedestroy($img);
550
        $path2   = pathinfo($img2);
551
        $img2    = imagecreatefromjpeg($img2);
@@ 554-565 (lines=12) @@
551
        $img2    = imagecreatefromjpeg($img2);
552
        $xratio2 = $pictwidth / imagesx($img2);
553
        $yratio2 = $pictheight / imagesy($img2);
554
        if ($xratio2 < 1 || $yratio2 < 1) {
555
            if ($xratio2 < $yratio2) {
556
                $resized2 = imagecreatetruecolor($pictwidth, floor(imagesy($img2) * $xratio2));
557
            } else {
558
                $resized2 = imagecreatetruecolor(floor(imagesx($img2) * $yratio2), $pictheight);
559
            }
560
            imagecopyresampled($resized2, $img2, 0, 0, 0, 0, imagesx($resized2) + 1, imagesy($resized2) + 1, imagesx($img2), imagesy($img2));
561
            imagejpeg($resized2, "{$path_upload}/midsize/resized_{$path2['basename']}");
562
            imagedestroy($resized2);
563
        } else {
564
            imagejpeg($img2, "{$path_upload}/midsize/resized_{$path2['basename']}");
565
        }
566
        imagedestroy($img2);
567
    }
568
}