Skip to content

Commit

Permalink
implement resize
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jan 20, 2025
1 parent 4bdc261 commit 372440a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Drivers/Vips/VipsDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,16 @@ public function image(): Image

public function resize(int $width, int $height, array $constraints): static
{
// TODO: Implement resize() method.
$resized = $this->getSize()->resize($width, $height, $constraints);

$widthRatio = $resized->width / $this->image->width;
$heightRatio = $resized->height / $this->image->height;

$this->image = $this->image->resize($widthRatio, [
'vscale' => $heightRatio
]);

return $this;
}

public function width(int $width, array $constraints = []): static
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 372440a

Please sign in to comment.