Code Duplication    Length = 23-23 lines in 2 locations

application/modules/gallery/admin.php 2 locations

@@ 969-991 (lines=23) @@
966
                $config['height'] = $this->conf['max_height'];
967
                $config['quality'] = $this->conf['quality'];
968
969
                if (($this->conf['maintain_ratio']) AND ($this->conf['crop'])) { // Уменьшаем изображение и обрезаем края
970
                    $size = $this->get_image_size($file['full_path']); // Получаем размеры сторон изображения
971
972
                    $size['width'] >= $size['height'] ? $config['master_dim'] = 'height' : $config['master_dim'] = 'width'; // Задаем master_dim
973
974
                    $this->image_lib->clear();
975
                    $this->image_lib->initialize($config);
976
                    $this->image_lib->resize();
977
978
                    $config['image_library'] = $this->conf['engine'];
979
                    $config['source_image'] = $file['full_path'];
980
                    $config['maintain_ratio'] = FALSE;
981
                    $config['width'] = $this->conf['max_width'];
982
                    $config['height'] = $this->conf['max_height'];
983
984
                    $this->image_lib->clear();
985
                    $this->image_lib->initialize($config);
986
                    $this->image_lib->crop();
987
                } else { // Только уменьшаем
988
                    $this->image_lib->clear();
989
                    $this->image_lib->initialize($config);
990
                    $this->image_lib->resize();
991
                }
992
            }
993
        }
994
        // Create image preview
@@ 1008-1030 (lines=23) @@
1005
            $config['height'] = $this->conf['prev_img_height'];
1006
            $config['quality'] = $this->conf['quality'];
1007
1008
            if (($this->conf['maintain_ratio_prev']) AND ($this->conf['crop_prev'])) { // Уменьшаем изображение и обрезаем края
1009
                $size = $this->get_image_size($file['full_path']); // Получаем размеры сторон изображения
1010
1011
                $size['width'] >= $size['height'] ? $config['master_dim'] = 'height' : $config['master_dim'] = 'width'; // Задаем master_dim
1012
1013
                $this->image_lib->clear();
1014
                $this->image_lib->initialize($config);
1015
                $this->image_lib->resize();
1016
1017
                $config['image_library'] = $this->conf['engine'];
1018
                $config['source_image'] = $prev_img_name;
1019
                $config['maintain_ratio'] = FALSE;
1020
                $config['width'] = $this->conf['prev_img_width'];
1021
                $config['height'] = $this->conf['prev_img_height'];
1022
1023
                $this->image_lib->clear();
1024
                $this->image_lib->initialize($config);
1025
                $this->image_lib->crop();
1026
            } else { // Только уменьшаем
1027
                $this->image_lib->clear();
1028
                $this->image_lib->initialize($config);
1029
                $this->image_lib->resize();
1030
            }
1031
        } else {
1032
            $this->load->helper('File');
1033
            $file_data = read_file($file['full_path']);