Code Duplication    Length = 5-5 lines in 2 locations

main/exercice/question.class.php 2 locations

@@ 630-634 (lines=5) @@
627
628
            // Resize according to height or width, both should not be larger than $Max after resizing.
629
            if ($Dimension == "any") {
630
                if ($current_height > $current_width || $current_height == $current_width) {
631
                    $resize_scale = $current_height / $Max;
632
                    $new_height = $Max;
633
                    $new_width = ceil($current_width / $resize_scale);
634
                }
635
                if ($current_height < $current_width) {
636
                    $resize_scale = $current_width / $Max;
637
                    $new_width = $Max;
@@ 635-639 (lines=5) @@
632
                    $new_height = $Max;
633
                    $new_width = ceil($current_width / $resize_scale);
634
                }
635
                if ($current_height < $current_width) {
636
                    $resize_scale = $current_width / $Max;
637
                    $new_width = $Max;
638
                    $new_height = ceil($current_height / $resize_scale);
639
                }
640
            }
641
642
            $my_image->resize($new_width, $new_height);