warpig
Spatie media library responsive images
found a solution for creating folders:
https://stackoverflow.com/questions/78482222/laravel-media-library-responsive-images
basically add this to your env
by default the plugin processes image conversions using queues by default. if you do not have queues configured or running, then conversions and/or responsive images will not be generated.
11 replies
Spatie media library responsive images
so basically, that's it, thanks for reading this long ass post. i am usually not very good at deciphering plugins and get really anxious and skeptical about documentations as the end result almost never ever ever ever ever works out as they intended. probably because every situation is different than the controlled environment they propose, and i can understand that. i also understand there could be a few things im not considering before trying out these concepts, hope someone can help.
11 replies
Spatie media library responsive images
what is the problem? several. actually.
1) one single image gets stored
within the route, no collection of images are created. i learnt that the desired outcome should output something like this:
this is the result on the html:
all i get is a blank srcset and can only grab the original image. 🥳
also, no conversions nor responsive-images folders are created either.
2) the thumbnail doesn't preview my image
if i want to edit a post, the thumbnail preview on the form fails to load any image inside the thumbnail box. i really don't know what's going on here probably something outside the scope of filament??
11 replies
Spatie media library responsive images
and finally, the blade:
https://spatie.be/docs/laravel-medialibrary/v11/responsive-images/getting-started-with-responsive-images
what i understand from this is that i can use srcset to display the collection of responsive images which depending on the context the image should resize and have to reference the collection as well as the conversion as you can see.
11 replies
Spatie media library responsive images
the method on my Post model has all of the classes imported and i am utilizing just one conversion 'thumb':
Preparing my model:https://spatie.be/docs/laravel-medialibrary/v11/basic-usage/preparing-your-model
https://spatie.be/docs/laravel-medialibrary/v11/converting-images/defining-conversions
what i understand now is that, method is used to specify "conversions" and you can apply several methods to it, since i need to have several responsive images, i am using filament will then auto generate medium, large and extra large versions for my post images.
edit:
i actually had to add several conversions, for example:
11 replies
Spatie media library responsive images
My form component looks like this:
Form component: https://filamentphp.com/plugins/filament-spatie-media-library#form-component
Generating responsive images: https://filamentphp.com/plugins/filament-spatie-media-library#generating-responsive-images
I learnt that you have to have a collection otherwise responsive images won't work.
11 replies