core-bundle/src/Resources/contao/library/Contao/GdImage.php
public function copyTo(self $gdImage, $x, $y, $width, $height)
	{
		imagecopyresampled($gdImage->getResource(), $this->gdResource, $x, $y, 0, 0, $width, $height, imagesx($this->gdResource), imagesy($this->gdResource));

		return $this;
	}
public function copyTo(self $gdImage, $x, $y, $width, $height)
	{
		imagecopyresampled($gdImage->getResource(), $this->gdResource, $x, $y, 0, 0, $width, $height, imagesx($this->gdResource), imagesy($this->gdResource));

		return $this;
	}
Save the GD image to a file

@param GdImage $gdImage The target GD image
@param integer $x       The target X coordinate
@param integer $y       The target Y coordinate
@param integer $width   The target width
@param integer $height  The target height

@return static