mlsolutions / nova-media-field
Laravel Nova media fields and host-authorized thumbnail previews.
Package info
github.com/ml-solutions-ltda/nova-media-field
Language:Vue
pkg:composer/mlsolutions/nova-media-field
Requires
- php: ^8.2
- laravel/nova: ^4.22 || ^5.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- tightenco/duster: ^3.0
Suggests
- spatie/laravel-medialibrary: Required only when using the Media field.
- stepanenko3/nova-filemanager: Optional File Manager integration. Install a release compatible with your Laravel Nova version.
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-08 20:33:14 UTC
README
Description
Laravel Nova media fields and host-authorized thumbnail previews.
Features
- Multiple / Single image support
- Multiple images auto-detect based on collection
- Display validation errors
- Show on index multiple images
- Modal with media details
- Show all conversions
- Open / Download / Copy URL of media
- Regenerate image with conversions
- Custom properties support
Requirements
php: >=8.2laravel/nova: ^4.22 or ^5.0spatie/laravel-medialibrary: ^11.4only when using theMediafield
The File Manager integration is optional. Install and register a File Manager release that supports the Laravel Nova version used by your application.
Installation
# Install the package
composer require mlsolutions/nova-media-field
Usage
use Mlsolutions\NovaMediaField\Fields\Media; ... Media::make(__('Image'), 'image'), // Single image. Auto detect from collection Media::make(__('Images'), 'images'), // Multiple images. Auto detect from collection // Validation rules Media::make('Images', 'images') ->rules(['required', 'array', 'max:4']) ->singleMediaRules(['image', 'max:80']), // Custom properties with validtion Media::make('Images', 'images') ->customPropertiesFields([ Boolean::make('Active', 'active') ->rules(['boolean']), Markdown::make('Description', 'description') ->rules(['max:1000']), ]) // Count images displayed on index Media::make('Images', 'images') ->countOfImagesDisplayedOnIndex(2), // Full example Media::make('Images', 'images') ->customPropertiesFields([ Boolean::make('Active', 'active') ->rules(['boolean']), Markdown::make('Description', 'description') ->rules(['max:1000']), ]) ->countOfImagesDisplayedOnIndex(2) ->rules(['required', 'array', 'max:4']) ->singleMediaRules(['image', 'max:80']),
Display a host-authorized thumbnail
Use Thumbnail for a read-only index preview when the host application owns the media model, storage, and authorization. The field renders only the URL passed to it; the host application must generate a reduced derivative and protect its route with the same authorization and tenant checks used for the media record.
use Mlsolutions\NovaMediaField\Fields\Thumbnail; Thumbnail::make('Miniatura', fn () => $authorizedPreviewUrl) ->altText($accessibleDescription) ->fallbackText('Prévia indisponÃvel') ->dimensions(64, 64) ->onlyOnIndex(),
The component never derives a URL from a storage path and never fetches the original file. A failed or missing preview URL displays the configured fallback. The Thumbnail field does not require spatie/laravel-medialibrary.
Usage with File Manager
Optionally install a Nova-compatible File Manager
composer require stepanenko3/nova-filemanager
Register Service provider
// app/Providers/NovaServiceProvider.php public function tools(): array { return [ new Stepanenko3\NovaFileManager\FileManagerTool, ]; }
Use Media field with File Manager
Media::make(__('Image'), 'image') ->fileManager(),
Screenshots
Credits
Contributing
Thank you for considering contributing to this package! Please create a pull request with your contributions with detailed explanation of the changes you are proposing.
License
This package is open-sourced software licensed under the MIT license.






