PHPackages                             marshmallow/advanced-nova-media-library - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. marshmallow/advanced-nova-media-library

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

marshmallow/advanced-nova-media-library
=======================================

Laravel Nova tools for managing the Spatie media library.

5.2.0(3mo ago)07.1k↑23.3%11MITVuePHP ^8.2CI failing

Since Jan 7Pushed 3w ago2 watchersCompare

[ Source](https://github.com/marshmallow-packages/advanced-nova-media-library)[ Packagist](https://packagist.org/packages/marshmallow/advanced-nova-media-library)[ RSS](/packages/marshmallow-advanced-nova-media-library/feed)WikiDiscussions main Synced today

READMEChangelog (9)Dependencies (10)Versions (13)Used By (1)

[![alt text](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67 "marshmallow.")](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67)

Laravel Advanced Nova Media Library
===================================

[](#laravel-advanced-nova-media-library)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0c97865e6ea497c4d52505238be6d24ecbc4df9f537afae15fbcc00fc3761ee3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f616476616e6365642d6e6f76612d6d656469612d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/advanced-nova-media-library)[![Total Downloads](https://camo.githubusercontent.com/7bcc3e761cc2098bd530739001fb425e91c0d9d585cecb2b9edaf91711642f0f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f616476616e6365642d6e6f76612d6d656469612d6c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/advanced-nova-media-library)

Laravel Nova tools for managing the [Spatie media library](https://github.com/spatie/laravel-medialibrary). Upload multiple images and order them by drag and drop.

Important

This package was originally forked from [ebess/advanced-nova-media-library](https://github.com/ebess/advanced-nova-media-library). Since we were making many opinionated changes, we decided to continue development in our own version rather than submitting pull requests that might not benefit all users of the original package. You're welcome to use this package, we're actively maintaining it. If you encounter any issues, please don't hesitate to reach out.

##### Table of Contents

[](#table-of-contents)

- [Examples](#examples)
- [Install](#install)
- [Configuration](#configuration)
- [Model media configuration](#model-media-configuration)
- [Generic file management](#generic-file-management)
- [Single image upload](#single-image-upload)
- [Multiple image upload](#multiple-image-upload)
- [Selecting existing media](#selecting-existing-media)
- [Names of uploaded images](#names-of-uploaded-images)
- [Responsive images](#responsive-images)
- [Image cropping](#image-cropping)
- [Custom properties](#custom-properties)
- [Show image statistics](#show-image-statistics-size-dimensions-type)
- [Custom headers](#custom-headers)
- [Media Field (Video)](#media-field-video)
- [Temporary Urls](#temporary-urls)
- [Credits](#credits)
- [License](#license)

Examples
--------

[](#examples)

[![Cropping](/docs/cropping.gif)](/docs/cropping.gif)[![Single image upload](/docs/single-image.png)](/docs/single-image.png)[![Multiple image upload](/docs/multiple-images.png)](/docs/multiple-images.png)[![Custom properties](/docs/custom-properties.gif)](/docs/custom-properties.gif)[![Generic file management](/docs/file-management.png)](/docs/file-management.png)

Install
-------

[](#install)

Install the package via Composer:

```
composer require marshmallow/advanced-nova-media-library
```

Publish the config file:

```
php artisan vendor:publish --tag=nova-media-library
```

This publishes the config to `config/nova-media-library.php`.

Configuration
-------------

[](#configuration)

The published `config/nova-media-library.php` file exposes the following options:

KeyDefaultDescription`default-croppable``true`Whether images are croppable by default. Set to `false` to disable cropping for all `Images` fields unless re-enabled per field.`enable-existing-media``false`Enables the endpoint and UI for selecting already uploaded media. **Exposes a media search endpoint to every user — keep disabled if your media is confidential.**`hide-media-collections``[]`Media collection names to exclude from the "existing media" search results.Model media configuration
-------------------------

[](#model-media-configuration)

Let's assume you configured your model to use the media library like following:

```
use Spatie\MediaLibrary\MediaCollections\Models\Media;

public function registerMediaConversions(Media $media = null): void
{
    $this->addMediaConversion('thumb')
        ->width(130)
        ->height(130);
}

public function registerMediaCollections(): void
{
    $this->addMediaCollection('main')->singleFile();
    $this->addMediaCollection('my_multi_collection');
}
```

Generic file management
-----------------------

[](#generic-file-management)

[![Generic file management](/docs/file-management.png)](/docs/file-management.png)

In order to be able to upload and handle generic files just go ahead and use the `Files` field.

```
use Marshmallow\AdvancedNovaMediaLibrary\Fields\Files;

Files::make('Single file', 'one_file'),
Files::make('Multiple files', 'multiple_files'),
```

Single image upload
-------------------

[](#single-image-upload)

[![Single image upload](/docs/single-image.png)](/docs/single-image.png)

```
use Marshmallow\AdvancedNovaMediaLibrary\Fields\Images;

public function fields(Request $request)
{
    return [
        Images::make('Main image', 'main') // second parameter is the media collection name
            ->conversionOnIndexView('thumb') // conversion used to display the image
            ->rules('required'), // validation rules
    ];
}
```

Multiple image upload
---------------------

[](#multiple-image-upload)

If you enable the multiple upload ability, you can **order the images via drag &amp; drop**.

[![Multiple image upload](/docs/multiple-images.png)](/docs/multiple-images.png)

```
use Marshmallow\AdvancedNovaMediaLibrary\Fields\Images;

public function fields(Request $request)
{
    return [
        Images::make('Images', 'my_multi_collection') // second parameter is the media collection name
            ->conversionOnPreview('medium-size') // conversion used to display the "original" image
            ->conversionOnDetailView('thumb') // conversion used on the model's view
            ->conversionOnIndexView('thumb') // conversion used to display the image on the model's index page
            ->conversionOnForm('thumb') // conversion used to display the image on the model's form
            ->fullSize() // full size column
            ->rules('required', 'size:3') // validation rules for the collection of images
            // validation rules for the collection of images
            ->singleImageRules('dimensions:min_width=100'),
    ];
}
```

Selecting existing media
------------------------

[](#selecting-existing-media)

[![Selecting existing media](/docs/existing-media.png)](/docs/existing-media.png)[![Selecting existing media 2](/docs/existing-media-2.png)](/docs/existing-media-2.png)

If you upload the same media files to multiple models and you do not want to select it from the file system all over again, use this feature. Selecting an already existing media will **copy it**.

**Attention**: This feature will expose an endpoint to every user of your application to search existing media. If your media upload / custom properties on the media models are confidential, **do not enable this feature!**

- Publish the config files if you did not yet

```
php artisan vendor:publish --tag=nova-media-library
```

- Enable this feature in config file *config/nova-media-library.php*

```
return [
    'enable-existing-media' => true,
];
```

- Enable the selection of existing media field

```
Images::make('Image')->enableExistingMedia(),
```

**Note**: This feature does not support temporary URLs.

Names of uploaded images
------------------------

[](#names-of-uploaded-images)

The default filename of the new uploaded file is the original filename. You can change this with the help of the function `setFileName`, which takes a callback function as the only param. This callback function has three params: `$originalFilename` (the original filename like `Fotolia 4711.jpg`), `$extension` (file extension like `jpg`), `$model` (the current model). Here are just 2 examples of what you can do:

```
// Set the filename to the MD5 Hash of original filename
Images::make('Image 1', 'img1')
    ->setFileName(function($originalFilename, $extension, $model){
        return md5($originalFilename) . '.' . $extension;
    });

// Set the filename to the model name
Images::make('Image 2', 'img2')
    ->setFileName(function($originalFilename, $extension, $model){
        return str_slug($model->name) . '.' . $extension;
    });
```

By default, the "name" field on the Media object is set to the original filename without the extension. To change this, you can use the `setName` function. Like `setFileName` above, it takes a callback function as the only param. This callback function has two params: `$originalFilename` and `$model`.

```
Images::make('Image 1', 'img1')
    ->setName(function($originalFilename, $model){
        return md5($originalFilename);
    });
```

Responsive images
-----------------

[](#responsive-images)

If you want to use responsive image functionality from the [Spatie MediaLibrary](https://docs.spatie.be/laravel-medialibrary/v7/responsive-images/getting-started-with-responsive-images), you can use the `withResponsiveImages()` function on the model.

```
Images::make('Image 1', 'img1')
    ->withResponsiveImages();
```

Image cropping
--------------

[](#image-cropping)

[![Cropping](/docs/cropping.gif)](/docs/cropping.gif)

By default you are able to crop / rotate images by clicking the scissors in the left bottom corner on the edit view. The [vue-js-clipper](https://github.com/timtnleeProject/vuejs-clipper) is used for this purpose. The cropping feature is limited to mime type of `image/jpg`, `image/jpeg` and `image/png`.

**Important:** By cropping an existing image the original media model is deleted and replaced by the cropped image. All custom properties are copied form the old to the new model.

To disable this feature use the `croppable` method:

```
Images::make('Gallery')->croppable(false);
```

You can set all configurations like ratio e.g. as following:

```
Images::make('Gallery')->croppingConfigs(['aspectRatio' => 4/3]);
```

Available cropping configuration, see .

It is possible to enforce cropping on upload, for example to ensure the image has the set aspect ratio:

```
Images::make('Gallery')->mustCrop();
```

### Disabling cropping by default

[](#disabling-cropping-by-default)

By default, the cropping feature is enabled. To disable it by default for all images set `default-croppable` in `config/nova-media-library.php` to `false`:

```
return [
    'default-croppable' => false,
];
```

Custom properties
-----------------

[](#custom-properties)

[![Custom properties](/docs/custom-properties.gif)](/docs/custom-properties.gif)

```
Images::make('Gallery')
    ->customPropertiesFields([
        Boolean::make('Active'),
        Markdown::make('Description'),
    ]);

Files::make('Multiple files', 'multiple_files')
    ->customPropertiesFields([
        Boolean::make('Active'),
        Markdown::make('Description'),
    ]);

// custom properties without user input
Files::make('Multiple files', 'multiple_files')
    ->customProperties([
        'foo' => auth()->user()->foo,
        'bar' => $api->getNeededData(),
    ]);
```

Show image statistics *(size, dimensions, type)*
------------------------------------------------

[](#show-image-statistics-size-dimensions-type)

[![Image statistics](/docs/show-statistics.png)](/docs/show-statistics.png)

```
Images::make('Gallery')
    ->showStatistics();
```

Custom headers
--------------

[](#custom-headers)

```
Images::make('Gallery')
    ->customHeaders([
        'header-name' => 'header-value',
    ]);
```

Media Field (Video)
-------------------

[](#media-field-video)

In order to handle videos with thumbnails you need to use the `Media` field instead of `Images`. This way you are able to upload videos as well.

```
use Marshmallow\AdvancedNovaMediaLibrary\Fields\Media;

class Category extends Resource
{
    public function fields(Request $request)
    {
        Media::make('Gallery') // media handles videos
            ->conversionOnIndexView('thumb')
            ->singleMediaRules('max:5000'); // max 5000kb
    }
}

// ..

class YourModel extends Model implements HasMedia
{
    public function registerMediaConversions(Media $media = null): void
    {
        $this->addMediaConversion('thumb')
            ->width(368)
            ->height(232)
            ->extractVideoFrameAtSecond(1);
    }
}
```

Temporary Urls
--------------

[](#temporary-urls)

If you are using Amazon S3 to store your media, you will need to use the `temporary` function on your field to generate a temporary signed URL. This function expects a valid Carbon instance that will specify when the URL should expire.

```
Images::make('Image 1', 'img1')
    ->temporary(now()->addMinutes(5))

Files::make('Multiple files', 'multiple_files')
    ->temporary(now()->addMinutes(10)),
```

**Note**: This feature does not work with the existing media feature.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please report security vulnerabilities by email rather than via the public issue tracker.

Credits
-------

[](#credits)

- [nova media library](https://github.com/jameslkingsley/nova-media-library)
- [ebess/advanced-nova-media-library](https://github.com/ebess/advanced-nova-media-library)
- [All Contributors](https://github.com/marshmallow-packages/advanced-nova-media-library/contributors)

License
-------

[](#license)

The MIT License. This package is open-sourced software licensed under the MIT license.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance88

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Total

9

Last Release

108d ago

Major Versions

v4.8.0 → 5.0.02025-02-27

PHP version history (2 changes)v4.7.0PHP ^8.0|^8.1

5.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/be33d2624e24c516e73892b0929447cc762f3622c024ab8d0d2a59042e5d2c7f?d=identicon)[marshmallow](/maintainers/marshmallow)

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (20 commits)")[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![milan607](https://avatars.githubusercontent.com/u/258212842?v=4)](https://github.com/milan607 "milan607 (1 commits)")

---

Tags

laravelnova

### Embed Badge

![Health badge](/badges/marshmallow-advanced-nova-media-library/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-advanced-nova-media-library/health.svg)](https://phpackages.com/packages/marshmallow-advanced-nova-media-library)
```

###  Alternatives

[ebess/advanced-nova-media-library

Laravel Nova tools for managing the Spatie media library.

6163.5M22](/packages/ebess-advanced-nova-media-library)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

58249.9k](/packages/sbine-route-viewer)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
