You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding media with medialibrary v11 using withManipulations, the BackedEnum BorderType gets transformed to its scalar string value before calling the manipulation itself.
This leads to the following type error:
Spatie\Image\Image::border(): Argument #2 ($type) must be of type Spatie\Image\Enums\BorderType, string given
The code used is as follows: $this->addMedia($params->favicon->file) ->preservingOriginal() ->withManipulations([ 'bgrectangle' => [ 'background' => ['color'=>$favIconbgcolor], 'border' => ['width' => $bordersize,'type' => BorderType::Expand, 'color'=>$bordercolor] ] ]) ->toMediaCollection('favicon');
The text was updated successfully, but these errors were encountered:
Ok, the problem occurs on FileAdder.php line 331 during $media->manipulations = $this->manipulations;the manipulation get cast to an array as requested in Models/Media.php on Line 74
For my purpose i just need a border, so i made it work for me now by recreating the Enum in Conversions/Manipulations 53
I made a PR but this is just a fast and dirty fix and has to be reviewed toroughly by
someone who has a better knwoledge of media-libary or functionality of custom casts in laravel.
When adding media with medialibrary v11 using withManipulations, the BackedEnum BorderType gets transformed to its scalar string value before calling the manipulation itself.
This leads to the following type error:
Spatie\Image\Image::border(): Argument #2 ($type) must be of type Spatie\Image\Enums\BorderType, string given
The code used is as follows:
$this->addMedia($params->favicon->file) ->preservingOriginal() ->withManipulations([ 'bgrectangle' => [ 'background' => ['color'=>$favIconbgcolor], 'border' => ['width' => $bordersize,'type' => BorderType::Expand, 'color'=>$bordercolor] ] ]) ->toMediaCollection('favicon');
The text was updated successfully, but these errors were encountered: