Reputation: 11
I want to use the following Laravel Spatie Media Library (https://github.com/spatie/laravel-medialibrary) for image manipulation. Is there any possible way how can I generate just and only "tiny & blurry tiny" image for media without use "withResponsiveImages"? I generated three conversions via registerMediaConversions. I would like to have also tiny versions for these three conversations but nothing else (I do not want to generate any other responsive images). withResponsiveImages default generate many files which are not needed.
Thank you for your help.
Upvotes: 0
Views: 1433
Reputation: 173
Since spatie/medialibrary uses spatie/image under the hood, you could simply use their blur function and resize methods to get a smaller image (https://spatie.be/docs/image/v1/image-manipulations/effects#blur) and then simply converting that image to base64 using base64_encode()
.
Laravel by default does not give you a file once uploaded, unsure with the instance from spatie/image, but either way you may need to create a temp file and then convert it to base64 to store that value.
An answer has been provided in their repo which might help you -> https://github.com/spatie/laravel-medialibrary/issues/1269
Upvotes: 0