Code Duplication    Length = 25-25 lines in 2 locations

class/class_thumbnail.php 2 locations

@@ 266-290 (lines=25) @@
263
                $imageCopyfunction   = (function_exists('ImageCopyResampled') && 'gd2' == $this->_image_type) ? 'imagecopyresampled' : 'imagecopyresized';
264
265
                switch ($this->_img_info[2]) {
266
                    case 1:
267
                        // GIF image
268
                        $img     = function_exists('imagecreatefromgif') ? imagecreatefromgif($this->_source_image) : imagecreatefrompng($this->_source_image);
269
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
270
                        $imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]);
271
                        if (function_exists('imagegif')) {
272
                            imagegif($tmp_img, $this->_save_image);
273
                        } else {
274
                            imagepng($tmp_img, $this->_save_image);
275
                        }
276
                        imagedestroy($tmp_img);
277
                        break;
278
279
                    case 2:
280
                        // echo $this->_save_image;
281
                        $img     = function_exists('imagecreatefromjpeg') ? imagecreatefromjpeg($this->_source_image) : imagecreatefrompng($this->_source_image);
282
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
283
                        $imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]);
284
                        if (function_exists('imagejpeg')) {
285
                            imagejpeg($tmp_img, $this->_save_image, $this->img_quality);
286
                        } else {
287
                            imagepng($tmp_img, $this->_save_image);
288
                        }
289
                        imagedestroy($tmp_img);
290
                        break;
291
292
                    case 3:
293
                        // PNG image
@@ 279-303 (lines=25) @@
276
                        imagedestroy($tmp_img);
277
                        break;
278
279
                    case 2:
280
                        // echo $this->_save_image;
281
                        $img     = function_exists('imagecreatefromjpeg') ? imagecreatefromjpeg($this->_source_image) : imagecreatefrompng($this->_source_image);
282
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
283
                        $imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]);
284
                        if (function_exists('imagejpeg')) {
285
                            imagejpeg($tmp_img, $this->_save_image, $this->img_quality);
286
                        } else {
287
                            imagepng($tmp_img, $this->_save_image);
288
                        }
289
                        imagedestroy($tmp_img);
290
                        break;
291
292
                    case 3:
293
                        // PNG image
294
                        $img     = imagecreatefrompng($this->_source_image);
295
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
296
                        $imageCopyfunction($tmp_img, $img, 0, 0, 0, 0, $newWidth, $newHeight, $this->_img_info[0], $this->_img_info[1]);
297
                        imagepng($tmp_img, $this->_save_image);
298
                        imagedestroy($tmp_img);
299
                        break;
300
                    default:
301
                        return false;
302
                }
303
                if (1 == $this->_return_fullpath) {
304
                    return $this->_source_url . "/{$this->_img_savepath}/{$savefile}";
305
                } else {
306
                    return "{$this->_img_savepath}/{$savefile}";