/** * 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; }
/** * {@inheritdoc} */ public function jsonSerialize() { return ['dims' => [$this->dimensions->getWidth(), $this->dimensions->getHeight()], 'type' => $this->type->getId(), 'bits' => $this->bits, 'channels' => $this->channels, 'mime' => $this->mime, 'exif' => $this->exif->getData()]; }
/** * Returns a hash string of this transaction. * * @return string */ public function getHash() { $path = str_replace('/', '_', $this->getFilePath()); return join('-', [$path, $this->action, $this->target->getWidth(), $this->target->getHeight()]); }
/** * Returns the image height. * * @return int */ public function getHeight() { return $this->dimensions->getHeight(); }