Skip to content

Commit

Permalink
Fix adding orientation as a manipulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed Nov 21, 2024
1 parent 2e6aa4f commit 44c4f39
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Conversions/Manipulations.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Spatie\Image\Enums\CropPosition;
use Spatie\Image\Enums\Fit;
use Spatie\Image\Enums\FlipDirection;
use Spatie\Image\Enums\Orientation;

/** @mixin \Spatie\Image\Drivers\ImageDriver */
class Manipulations
Expand Down Expand Up @@ -59,6 +60,7 @@ public function apply(ImageDriver $image): void
{
foreach ($this->manipulations as $manipulationName => $parameters) {
$parameters = $this->transformParameters($manipulationName, $parameters);
ray('apply', $manipulationName, gettype($parameters), $parameters)->orange();

Check failure on line 63 in src/Conversions/Manipulations.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to method orange() on an unknown class Spatie\RayBundle\Ray.

Check failure on line 63 in src/Conversions/Manipulations.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to method orange() on an unknown class Spatie\WordPressRay\Ray.

Check failure on line 63 in src/Conversions/Manipulations.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to method orange() on an unknown class Spatie\YiiRay\Ray.
$image->$manipulationName(...$parameters);
}
}
Expand Down Expand Up @@ -129,6 +131,11 @@ public function transformParameters(int|string $manipulationName, mixed $paramet
$parameters['flip'] = FlipDirection::from($parameters['flip']);
}
break;
case 'orientation':
if (isset($parameters['orientation']) && ! $parameters['orientation'] instanceof Orientation) {
$parameters['orientation'] = Orientation::from($parameters['orientation']);
}
break;
default:
break;
}
Expand Down

0 comments on commit 44c4f39

Please sign in to comment.