PHPackages                             optimistdigital/nova-media-field - 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. [Image &amp; Media](/categories/media)
4. /
5. optimistdigital/nova-media-field

AbandonedArchivedLibrary[Image &amp; Media](/categories/media)

optimistdigital/nova-media-field
================================

Laravel Nova field for image/gallery upload and library browsing.

3.1.2(3y ago)5534.7k↓51.7%14[6 issues](https://github.com/outl1ne/nova-media-field/issues)[9 PRs](https://github.com/outl1ne/nova-media-field/pulls)1MITVuePHP &gt;=8.0.0

Since Aug 28Pushed 3y ago5 watchersCompare

[ Source](https://github.com/outl1ne/nova-media-field)[ Packagist](https://packagist.org/packages/optimistdigital/nova-media-field)[ RSS](/packages/optimistdigital-nova-media-field/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (69)Used By (1)

NB! Nova Media Field is now deprecated in the favour of [Nova Media Hub](https://github.com/outl1ne/nova-media-hub)
-------------------------------------------------------------------------------------------------------------------

[](#nb-nova-media-field-is-now-deprecated-in-the-favour-of-nova-media-hub)

**No further updates will be provided!**

---

Nova Media Field
================

[](#nova-media-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d57cd927f6d46ee3135ef62010407d0e70d8c980f6cc22d37e0e286388dc63fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f7074696d6973746469676974616c2f6e6f76612d6d656469612d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/optimistdigital/nova-media-field)[![Total Downloads](https://camo.githubusercontent.com/35babd874eef5aec8ed8d42f4617126f6d3b5cd3c11b5ba953c6b8a125005f76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f7074696d6973746469676974616c2f6e6f76612d6d656469612d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/optimistdigital/nova-media-field)

This [Laravel Nova](https://nova.laravel.com) package adds a simple media upload field with a media browser to Laravel Nova.

Requirements
------------

[](#requirements)

- Imagick
- Laravel Nova &gt;= 2.10.0

Features:
---------

[](#features)

- Handles any type of file
- Media browser
- Drag-and-drop multi file upload
- Multiple file selection
- Drag and drop reordering of selected files
- Collections
- Thumbnail generator with custom sizes (also re-generation via command)
- WebP generator (also re-generation via command)
- Works with [nova-translatable](https://github.com/optimistdigital/nova-translatable)

Upgrading to v2
---------------

[](#upgrading-to-v2)

Check [CHANGELOG.MD](https://github.com/optimistdigital/nova-media-field/blob/v2/CHANGELOG.md)

Installation
------------

[](#installation)

Install the package in a Laravel Nova project via Composer and run migrations:

```
# Install package
composer require optimistdigital/nova-media-field

# And then run migrations
php artisan migrate
```

And then register the `NovaMediaLibrary` tool in `NovaServiceProvider`:

```
use OptimistDigital\MediaField\NovaMediaLibrary;

public function tools()
{
    return [
        new \OptimistDigital\MediaField\NovaMediaLibrary,
    ];
}

```

Usage
-----

[](#usage)

```
use OptimistDigital\MediaField\MediaField;

// ...

fields() {
  return [
    MediaField::make('Profile image', 'profile_image'),

    // Configurable options:
    MediaField::make('Config example', 'config_example')
      ->multiple() // Allows multiple images to to be selected
      ->collection('profile-pictures') // Defines a fixed collection of images instead of a global scope
      ->compact($width, $height = null) // Defines the thumbnail image size shown in Nova (to actually change thumbnail image size, use config)
  ]
}

```

### Image thumbnails

[](#image-thumbnails)

Image thumbnails define different conversions for uploaded images. These conversions can be configured under media field config file under `image_sizes` key.

```
# config/nova-media-field.php

[
    'image_sizes' => [
        'thumbnail' => [
            'width' => 150,
            'height' => 150,
            'crop' => true
        ],
        'medium' => [
            'width' => 300
        ]
    ],
]

```

- `crop` - Default: `false`, when `true` then image might be cropped if not fit for defined ratio. Requires width and height to be defined.
- `width` - Width to resize the image
- `height` - Height to resize the image

Defining only one dimension (width or height) keeps the ratio.

### Video thumbnails

[](#video-thumbnails)

Media field can generate thumbnails from the first frame of the video. It uses `ffmpeg` and `php-ffmpeg` to achieve this.

To enable this, you must:

- Install `ffmpeg`
- Provide paths to `ffmpeg` and `ffprobe` (on some environments)

If `ffmpeg` and `ffprobe` paths are not automatically detected, add these variables to your ENV.

```
# NB! Including extension (ie .exe on Windows)
FFMPEG_PATH=/usr/local/bin/ffmpeg
FFPROBE_PATH=/usr/local/bin/ffprobe
```

### WebP support

[](#webp-support)

By default WebP support is enabled in nova media config file. On image upload the WebP will be generated automatically for you. If you have activated or plan to activate it later then you can use commands below to regenerate missing thumbnails and WebP files.

### Regenerate thumbnails

[](#regenerate-thumbnails)

To regenerate thumbnails (after defining a new thumbnail size etc) run this command:

```
php artisan media:regenerate-thumbnails
```

### Regenerate WebP files

[](#regenerate-webp-files)

To regenerate your missing WebP files run this command:

```
php artisan media:regenerate-webp
```

### Collections

[](#collections)

Collections are basically upload groups that can have their own set of upload rules. Collection configuration goes under media field config file under `collection` key.

```
# config/nova-media-field.php

[
    'collections' => [
        'banners' => [
            'label' => 'Banners',
            'constraints' => [
                'mimetypes' => [
                    'image/svg+xml',
                    'image/svg'
                ]
            ],
            'image_sizes' => [
                'thumbnail'
            ]
        ]
    ],
]

```

- `label` - Display label for collection
- `constraints` - Array of validation rules (like in Request validation)
- `image_sizes` - Sizes to generate (overrides default)

### Handle duplicate uploads

[](#handle-duplicate-uploads)

If `resolve_duplicates` is set to true then md5 hash of first mb of the original uploaded file will be generated and used to check if any file duplicates are discovered. If there is then it will serve existing media item without saving the new one.

```
# config/nova-media-field.php

[
    // When enabled tries to find if file already exists and
    // serve that instead of creating a duplicate entry
    'resolve_duplicates' => true,
]

```

### Customizing

[](#customizing)

This package allows overriding of core logic for any custom needs project may have

```
# config/nova-media-field.php
[
    // media_handler is core class that handles file uploads, storage and thumbnail generation
    'media_handler' => \OptimistDigital\MediaField\Classes\MediaHandler::class,

    // media_resource is nova resource class for Media
    'media_resource' => \OptimistDigital\MediaField\Media::class,

    // media_model is laravel modal used throughout this package
    'media_model' => \OptimistDigital\MediaField\Models\Media::class,
]

```

Credits
-------

[](#credits)

- [Marttin Notta](https://github.com/marttinnotta)
- [Tarvo Reinpalu](https://github.com/Tarpsvo)

License
-------

[](#license)

Nova Media Field is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 67.4% 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 ~23 days

Recently: every ~77 days

Total

53

Last Release

1218d ago

Major Versions

0.1.20 → 1.0.02020-04-24

1.3.11 → 2.0.0-alpha.12021-04-13

1.4.1 → 2.0.12021-06-18

2.1.4 → 3.0.02022-03-04

PHP version history (2 changes)0.1.0PHP &gt;=7.1.0

3.0.0PHP &gt;=8.0.0

### Community

Maintainers

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

---

Top Contributors

[![Tarpsvo](https://avatars.githubusercontent.com/u/2018660?v=4)](https://github.com/Tarpsvo "Tarpsvo (145 commits)")[![marttinnotta](https://avatars.githubusercontent.com/u/7058209?v=4)](https://github.com/marttinnotta "marttinnotta (28 commits)")[![pitchayakit](https://avatars.githubusercontent.com/u/17026022?v=4)](https://github.com/pitchayakit "pitchayakit (11 commits)")[![Mikkoun](https://avatars.githubusercontent.com/u/9199470?v=4)](https://github.com/Mikkoun "Mikkoun (6 commits)")[![milewski](https://avatars.githubusercontent.com/u/2874967?v=4)](https://github.com/milewski "milewski (6 commits)")[![kaareloun](https://avatars.githubusercontent.com/u/19284921?v=4)](https://github.com/kaareloun "kaareloun (5 commits)")[![KasparRosin](https://avatars.githubusercontent.com/u/33309407?v=4)](https://github.com/KasparRosin "KasparRosin (4 commits)")[![allantatter](https://avatars.githubusercontent.com/u/386999?v=4)](https://github.com/allantatter "allantatter (3 commits)")[![LINKeRxUA](https://avatars.githubusercontent.com/u/21177131?v=4)](https://github.com/LINKeRxUA "LINKeRxUA (2 commits)")[![murad-optimist](https://avatars.githubusercontent.com/u/81748898?v=4)](https://github.com/murad-optimist "murad-optimist (1 commits)")[![Gertiozuni](https://avatars.githubusercontent.com/u/26062255?v=4)](https://github.com/Gertiozuni "Gertiozuni (1 commits)")[![powolnymarcel](https://avatars.githubusercontent.com/u/12711039?v=4)](https://github.com/powolnymarcel "powolnymarcel (1 commits)")[![RistoNiinemets](https://avatars.githubusercontent.com/u/3982627?v=4)](https://github.com/RistoNiinemets "RistoNiinemets (1 commits)")[![furkangzk](https://avatars.githubusercontent.com/u/82597669?v=4)](https://github.com/furkangzk "furkangzk (1 commits)")

---

Tags

laravelmedianovaoptimistdigital

### Embed Badge

![Health badge](/badges/optimistdigital-nova-media-field/health.svg)

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

###  Alternatives

[classic-o/nova-media-library

Tool and field that will let you managing files and add them to the posts

154172.0k](/packages/classic-o-nova-media-library)[ctessier/nova-advanced-image-field

An advanced image field for Nova with cropping and resizing.

103548.4k1](/packages/ctessier-nova-advanced-image-field)[mostafaznv/nova-ckeditor

CkEditor for Laravel Nova

57327.2k1](/packages/mostafaznv-nova-ckeditor)[silvanite/nova-field-cloudinary

A Laravel Nova Image Field with Flysystem Adapter for storing and retrieving media from Cloudinary

2772.0k3](/packages/silvanite-nova-field-cloudinary)[stepanenko3/nova-media-field

A Laravel Nova field for laravel-medilibrary.

1717.5k](/packages/stepanenko3-nova-media-field)[mostafaznv/nova-video

Video Field for Laravel Nova

22398.0k1](/packages/mostafaznv-nova-video)

PHPackages © 2026

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