Code Duplication    Length = 5-7 lines in 3 locations

lib/private/image.php 3 locations

@@ 796-800 (lines=5) @@
793
		}
794
795
		imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig);
796
		if ($process == false) {
797
			OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$width.'x'.$height, OC_Log::ERROR);
798
			imagedestroy($process);
799
			return false;
800
		}
801
		imagedestroy($this->resource);
802
		$this->resource = $process;
803
		return true;
@@ 853-859 (lines=7) @@
850
		}
851
852
		imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
853
		if ($process == false) {
854
			OC_Log::write('core',
855
				'OC_Image->centerCrop. Error resampling process image '.$width.'x'.$height,
856
				OC_Log::ERROR);
857
			imagedestroy($process);
858
			return false;
859
		}
860
		imagedestroy($this->resource);
861
		$this->resource = $process;
862
		return true;
@@ 893-897 (lines=5) @@
890
		}
891
892
		imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h);
893
		if ($process == false) {
894
			OC_Log::write('core', __METHOD__.'(): Error resampling process image '.$w.'x'.$h, OC_Log::ERROR);
895
			imagedestroy($process);
896
			return false;
897
		}
898
		imagedestroy($this->resource);
899
		$this->resource = $process;
900
		return true;