Back to Laravel Medialibrary

Generating custom URLs

docs/advanced-usage/generating-custom-urls.md

11.22.1546 B
Original Source

When getUrl is called, the task of generating that URL is passed to an implementation of Spatie\MediaLibrary\Support\UrlGenerator\UrlGenerator.

The package contains a DefaultUrlGenerator that can generate URLs for a media library that is stored inside the public path. It can also generate URLs for S3.

If you are storing your media files in a private directory or are using a different filesystem, you can write your own UrlGenerator. Your generator must implement the Spatie\MediaLibrary\Support\UrlGenerator\UrlGenerator interface.