Code Duplication    Length = 25-25 lines in 2 locations

class/class_thumbnail.php 2 locations

@@ 283-307 (lines=25) @@
280
                    && $this->_image_type == 'gd2') ? 'imagecopyresampled' : 'imagecopyresized';
281
282
                switch ($this->_img_info[2]) {
283
                    case 1:
284
                        // GIF image
285
                        $img     = (function_exists('imagecreatefromgif')) ? imagecreatefromgif(
286
                            $this->_source_image
287
                        ) : imageCreateFromPNG($this->_source_image);
288
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
289
                        $imageCopyfunction(
290
                            $tmp_img,
291
                            $img,
292
                            0,
293
                            0,
294
                            0,
295
                            0,
296
                            $newWidth,
297
                            $newHeight,
298
                            $this->_img_info[0],
299
                            $this->_img_info[1]
300
                        );
301
                        if (function_exists('imagegif')) {
302
                            imagegif($tmp_img, $this->_save_image);
303
                        } else {
304
                            imagePNG($tmp_img, $this->_save_image);
305
                        }
306
                        imagedestroy($tmp_img);
307
                        break;
308
309
                    case 2:
310
                        // echo $this->_save_image;
@@ 309-333 (lines=25) @@
306
                        imagedestroy($tmp_img);
307
                        break;
308
309
                    case 2:
310
                        // echo $this->_save_image;
311
                        $img     = (function_exists('imagecreatefromjpeg')) ? imageCreateFromJPEG(
312
                            $this->_source_image
313
                        ) : imageCreateFromPNG($this->_source_image);
314
                        $tmp_img = $imageCreateFunction($newWidth, $newHeight);
315
                        $imageCopyfunction(
316
                            $tmp_img,
317
                            $img,
318
                            0,
319
                            0,
320
                            0,
321
                            0,
322
                            $newWidth,
323
                            $newHeight,
324
                            $this->_img_info[0],
325
                            $this->_img_info[1]
326
                        );
327
                        if (function_exists('imagejpeg')) {
328
                            imageJPEG($tmp_img, $this->_save_image, $this->img_quality);
329
                        } else {
330
                            imagePNG($tmp_img, $this->_save_image);
331
                        }
332
                        imagedestroy($tmp_img);
333
                        break;
334
335
                    case 3:
336
                        // PNG image