Code Duplication    Length = 23-24 lines in 2 locations

thumbs/phpthumb.class.php 2 locations

@@ 740-762 (lines=23) @@
737
                    @$ImageOutFunction($this->gdimg_output);
738
                    break;
739
740
                case 'bmp':
741
                    if (!@require_once __DIR__ . '/phpthumb.bmp.php') {
742
                        $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.bmp.php" which is required for BMP format output', __FILE__, __LINE__);
743
744
                        return false;
745
                    }
746
                    $phpthumb_bmp = new phpthumb_bmp();
747
                    if (is_object($phpthumb_bmp)) {
748
                        $bmp_data = $phpthumb_bmp->GD2BMPstring($this->gdimg_output);
749
                        unset($phpthumb_bmp);
750
                        if (!$bmp_data) {
751
                            $this->DebugMessage('$phpthumb_bmp->GD2BMPstring() failed', __FILE__, __LINE__);
752
753
                            return false;
754
                        }
755
                        header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat));
756
                        echo $bmp_data;
757
                    } else {
758
                        $this->DebugMessage('new phpthumb_bmp() failed', __FILE__, __LINE__);
759
760
                        return false;
761
                    }
762
                    break;
763
764
                case 'ico':
765
                    if (!@require_once __DIR__ . '/phpthumb.ico.php') {
@@ 764-787 (lines=24) @@
761
                    }
762
                    break;
763
764
                case 'ico':
765
                    if (!@require_once __DIR__ . '/phpthumb.ico.php') {
766
                        $this->DebugMessage('Error including "' . __DIR__ . '/phpthumb.ico.php" which is required for ICO format output', __FILE__, __LINE__);
767
768
                        return false;
769
                    }
770
                    $phpthumb_ico = new phpthumb_ico();
771
                    if (is_object($phpthumb_ico)) {
772
                        $arrayOfOutputImages = array($this->gdimg_output);
773
                        $ico_data            = $phpthumb_ico->GD2ICOstring($arrayOfOutputImages);
774
                        unset($phpthumb_ico);
775
                        if (!$ico_data) {
776
                            $this->DebugMessage('$phpthumb_ico->GD2ICOstring() failed', __FILE__, __LINE__);
777
778
                            return false;
779
                        }
780
                        header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($this->thumbnailFormat));
781
                        echo $ico_data;
782
                    } else {
783
                        $this->DebugMessage('new phpthumb_ico() failed', __FILE__, __LINE__);
784
785
                        return false;
786
                    }
787
                    break;
788
789
                default:
790
                    $this->DebugMessage('OutputThumbnail failed because $this->thumbnailFormat "' . $this->thumbnailFormat . '" is not valid', __FILE__, __LINE__);