From 8772e501221c65d427a21806c678278c1dd54fea Mon Sep 17 00:00:00 2001 From: Mathieu Date: Mon, 18 Mar 2024 08:36:14 +0000 Subject: [PATCH] imageEditOptions --- src/FileRequest.php | 20 ++++++++++++++++- src/ImageEditOptions.php | 48 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/ImageEditOptions.php diff --git a/src/FileRequest.php b/src/FileRequest.php index deeed62..4582563 100644 --- a/src/FileRequest.php +++ b/src/FileRequest.php @@ -20,6 +20,10 @@ class FileRequest * @var Metadata */ private $metadata; + /** + * @var ImageEditOptions + */ + private $imageEditOptions; public function __construct(string $url, string $fallbackUrl = null) { @@ -28,6 +32,7 @@ class FileRequest $this->fileOptions = new FileOptions(); $this->metadata = new Metadata(); + $this->imageEditOptions = new ImageEditOptions(); } public function url(string $url) @@ -68,6 +73,18 @@ class FileRequest return $this->metadata; } + public function imageEditOptions(ImageEditOptions $imageEditOptions) + { + $this->imageEditOptions = $imageEditOptions; + + return $this; + } + + public function getImageEditOptions(): ImageEditOptions + { + return $this->imageEditOptions; + } + public function getUrl(): string { return $this->url; @@ -84,7 +101,8 @@ class FileRequest 'url' => $this->url, 'fallbackUrl' => $this->fallbackUrl, 'fileOptions' => $this->fileOptions->toArray(), - 'metadata' => $this->metadata->toArray() + 'metadata' => $this->metadata->toArray(), + 'imageEditOptions' => $this->imageEditOptions->toArray() ]); } } diff --git a/src/ImageEditOptions.php b/src/ImageEditOptions.php new file mode 100644 index 0000000..4263d45 --- /dev/null +++ b/src/ImageEditOptions.php @@ -0,0 +1,48 @@ +width = $width; + + return $this; + } + + public function getWidth(): int + { + return $this->width; + } + + public function height(int $height) + { + $this->height = $height; + + return $this; + } + + public function getHeight(): int + { + return $this->height; + } + + public function toArray(): array + { + return array_filter([ + 'width' => $this->width, + 'height' => $this->height + ]); + } +}