shirshak55/advanced-nova-media-library
Laravel Nova field for advanced media management: upload images and files, crop and resize, generate responsive versions, organize multiple collections, reorder with drag and drop, and attach custom properties. A maintained fork of ebess/advanced-nova-media-library for richer Nova admin interfaces.
The 3.0.0 release is a compatibility major: it targets the current Laravel Nova and spatie/laravel-medialibrary releases. Treat it as an upgrade assessment first, not a drop-in patch.
composer.json constraints before upgrading. You will likely need a current Nova major, spatie/laravel-medialibrary v11+, PHP 8.2+, and a supported Laravel version. Confirm this against your app before running composer update.composer require <vendor>/<package>:^3.0 --with-all-dependencies
php artisan vendor:publish --tag=<package-config>
php artisan migrate
Spatie\MediaLibrary\InteractsWithMedia and implements registerMediaCollections() / registerMediaConversions().use <Vendor>\<Package>\<MediaField>;
public function fields(NovaRequest $request)
{
return [
<MediaField>::make('Images')
->collection('images')
->multiple()
->accept('image/*')
->maxFiles(10),
];
}
Look first at the package README, CHANGELOG.md, and upgrade notes for 3.0.0, then inspect the field class and any published config. The first practical use case is a single image or avatar upload on a Nova resource, with one thumbnail conversion defined in the model.
Single-file and multi-file collections. Define the collection once in the model and reuse the exact same name in the Nova field. For a single avatar:
public function registerMediaCollections(): void
{
$this->addMediaCollection('avatar')->singleFile();
}
Then use the Nova field with ->collection('avatar') and without ->multiple(). For galleries, use ->multiple() and enforce limits with ->maxFiles().
Conversions belong in the model, not the field. Register conversions in registerMediaConversions() and reference the conversion name from the Nova field where previews are supported. This keeps URLs, API output, and Nova previews consistent.
Disk and visibility per collection. Configure the disk on the model collection and mirror it on the field when the field supports it. This matters for S3, private buckets, and environments where local and production storage differ. Keep private media out of public previews or render it through temporary URLs.
Validation at the Nova layer. Use field rules for file type and size, for example ->rules('required', 'image', 'max:2048'), and combine with ->creationRules() / ->updateRules() when uploads are mandatory only on create. Keep server-side Media Library validation in the model as well if uploads can arrive outside Nova.
Admin-only versus application uploads. The Nova field is an admin UI convenience. For front-end or API uploads, use Media Library directly (addMediaFromRequest, addMediaFromDisk, etc.) and let Nova manage existing media. This avoids coupling public upload flows to a Nova field.
Queued conversions. If conversions are queued in the model, a worker must be running or Nova previews will appear missing after upload. This is common in production and easy to misdiagnose as a broken field.
Lifecycle hooks. Use Nova field visibility methods (->hideFromIndex(), ->onlyOnForms(), ->download()) to keep resource tables readable. For custom metadata, use Media Library custom properties from the model or the field’s supported property API, and expose them through accessors rather than duplicating logic in Nova.
upload_max_filesize / post_max_size, Livewire temporary upload limits, or the Media Library temporary disk configuration. Check these before debugging the field itself.php artisan config:clear, re-publish config if needed, and restart queue workers. Stale config is a common cause of “the upgrade did nothing” reports.Media model, add media collections per tenant or model type, override field methods for custom UI, and use model accessors for canonical URLs. Keep these customizations outside vendor files so the next major upgrade remains tractable.How can I help you explore Laravel packages today?