This is the documentation for
v7 but the latest version is
v10
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-medialibrary
Whenever you use a $media
instance as output in a Blade view the medialibrary will generate a img
tag with the necessary src
, srcset
and alt
attributes. You can customize the rendered output by publishing the views
with:
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="views"
The following files will be published in the resources/views/vendor/medialibrary
directory:
-
image.blade.php
: will be used to render media without responsive images
-
responsiveImage.blade.php
: will be used to render media with responsive images without a tiny placeholder
-
responsiveImageWithPlaceholder.blade.php
: will be used to render media with responsive images including a tiny placeholder.
You may modify these published views to your heart's content.