19 declare(strict_types=1);
39 bool $throw_on_error =
false 43 ->withMakeTemporaryFiles(
false)
44 ->withThrowOnError($throw_on_error);
60 $this->conversion_options
61 ->withFitIn($fit_into_size)
63 ->withKeepAspectRatio(
true),
64 $this->
merge($image_output_options),
79 $this->conversion_options
80 ->withFitIn($square_size)
81 ->withKeepAspectRatio(
true)
83 $this->
merge($image_output_options),
100 $this->conversion_options
102 ->withKeepAspectRatio(
true),
103 $this->
merge($image_output_options),
120 $this->conversion_options
121 ->withHeight($height)
122 ->withKeepAspectRatio(
true),
123 $this->
merge($image_output_options),
138 bool $crop_or_otherwise_squeeze =
true,
142 $this->conversion_options
144 ->withHeight($height)
145 ->withCrop($crop_or_otherwise_squeeze)
146 ->withKeepAspectRatio(
true),
147 $this->
merge($image_output_options),
166 $conversion_options = $this->conversion_options
170 if ($height !== null) {
171 $conversion_options = $conversion_options->
withHeight($height);
173 if ($width !== null) {
174 $conversion_options = $conversion_options->
withWidth($width);
176 if ($width === null && $height === null) {
181 $this->
merge($image_output_options)->withFormat($to_format),
188 if ($image_output_options !== null) {
189 return $this->image_output_options
191 ->withFormat($image_output_options->
getFormat());
resizeByHeight(FileStream $stream, int $height, ImageOutputOptions $image_output_options=null)
Resizes an image to an image with the given height.
convertToFormat(FileStream $stream, string $to_format, ?int $width=null, ?int $height=null, ImageOutputOptions $image_output_options=null)
Creates an image from the given stream, converted to the desired format.
withWidth(int $width)
Resize the image to the given width.
withKeepAspectRatio(bool $keep_aspect_ratio)
Keep the aspect ratio while resizing the image.
thumbnail(FileStream $stream, int $fit_into_size, ImageOutputOptions $image_output_options=null)
Creates an image from the given stream which fits into the given size and keeps the aspect ratio...
ImageConversionOptions $conversion_options
withKeepDimensions(bool $keep)
No resizing, the original image dimension will be used.
croppedSquare(FileStream $stream, int $square_size, ImageOutputOptions $image_output_options=null)
Creates an image from the given stream which fits into the given size, but is cropped to fill the who...
resizeToFixedSize(FileStream $stream, int $width, int $height, bool $crop_or_otherwise_squeeze=true, ImageOutputOptions $image_output_options=null)
Creates an image from the given stream, resized to width and height given.
withQuality(int $image_quality)
set the image compression quality.
__construct(bool $throw_on_error=false)
ImageOutputOptions $image_output_options
merge(?ImageOutputOptions $image_output_options)
The base interface for all filesystem streams.
withHeight(int $height)
Resize the image to the given height.
resizeByWidth(FileStream $stream, int $width, ImageOutputOptions $image_output_options=null)
Resizes an image to an image with the given width.