Code Duplication    Length = 6-8 lines in 2 locations

thumbs/phpthumb.class.php 2 locations

@@ 2917-2922 (lines=6) @@
2914
                        }
2915
2916
                        // scan through current truecolor image copy alpha channel to temp image as grayscale
2917
                        for ($x = 0; $x < $this->thumbnail_width; $x++) {
2918
                            for ($y = 0; $y < $this->thumbnail_height; $y++) {
2919
                                $PixelColor = phpthumb_functions::GetPixelColor($this->gdimg_output, $x, $y);
2920
                                imagesetpixel($img_alpha_mixdown_dither, $x, $y, $dither_color[$PixelColor['alpha'] * 2]);
2921
                            }
2922
                        }
2923
2924
                        // dither alpha channel grayscale version down to 2 colors
2925
                        imagetruecolortopalette($img_alpha_mixdown_dither, true, 2);
@@ 2936-2943 (lines=8) @@
2933
2934
                        // scan through alpha channel image and note pixels with >50% transparency
2935
                        $TransparentPixels = array();
2936
                        for ($x = 0; $x < $this->thumbnail_width; $x++) {
2937
                            for ($y = 0; $y < $this->thumbnail_height; $y++) {
2938
                                $AlphaChannelPixel = phpthumb_functions::GetPixelColor($img_alpha_mixdown_dither, $x, $y);
2939
                                if ($AlphaChannelPixel['red'] > 127) {
2940
                                    imagesetpixel($this->gdimg_output, $x, $y, $TransparentColor);
2941
                                }
2942
                            }
2943
                        }
2944
                        imagedestroy($img_alpha_mixdown_dither);
2945
2946
                        $this->DebugMessage('AlphaChannelFlatten() set image to 255+1 colors with transparency for GIF output', __FILE__, __LINE__);