/** * Resize part of an image with resampling. * * @param Point $destPoint The destination point * @param Point $srcPoint The source point * @param Dimensions $destDimensions The destination dimensions * @param Dimensions $srcDimensions The source dimensions * @param ImageResource $dest Optional destination image. Default is current image. * * @return ImageResource This image */ public function resample(Point $destPoint, Point $srcPoint, Dimensions $destDimensions, Dimensions $srcDimensions, ImageResource $dest = null) { $dest = $dest ?: clone $this; imagecopyresampled($dest->resource, $this->resource, $destPoint->getX(), $destPoint->getY(), $srcPoint->getX(), $srcPoint->getY(), $destDimensions->getWidth(), $destDimensions->getHeight(), $srcDimensions->getWidth(), $srcDimensions->getHeight()); $this->resource = $dest->resource; $this->resetInfo(); return $this; }