All Projects → jameslkingsley → nova-media-library

jameslkingsley / nova-media-library

Licence: other
A Laravel Nova field for displaying and updating a Spatie Media Library model.

Programming Languages

Vue
7211 projects
PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to nova-media-library

nova-horizon-link
Smart Link for Laravel Nova to Horizon Dashboard.
Stars: ✭ 24 (-42.86%)
Mutual labels:  nova
cast control
📺 Control Chromecasts from Linux and D-Bus
Stars: ✭ 443 (+954.76%)
Mutual labels:  media
laravel-nova-visual-composer
Visual Composer for Laravel Nova
Stars: ✭ 15 (-64.29%)
Mutual labels:  nova
nova-ohdear-tool
A Nova tool to display downtime, broken links and mixed content
Stars: ✭ 29 (-30.95%)
Mutual labels:  nova
mp4
🎥 Basic MP4 reader in Go! CLI + Golang Package for ISO/IEC 14496-12 - ISO Base Media File Format
Stars: ✭ 75 (+78.57%)
Mutual labels:  media
media srcset
Media-SrcSet implementiert SRCSET-Funktionalität.
Stars: ✭ 36 (-14.29%)
Mutual labels:  media
Rox.Video.Xamarin
Rox Video Control for Xamarin.Forms
Stars: ✭ 17 (-59.52%)
Mutual labels:  media
instantsearch-android-examples
Example apps built with algolia/instantsearch-android
Stars: ✭ 60 (+42.86%)
Mutual labels:  media
Radio
Simple Android webradio player
Stars: ✭ 21 (-50%)
Mutual labels:  media
Nova-Dark-Theme
A dark theme for Laravel Nova
Stars: ✭ 72 (+71.43%)
Mutual labels:  nova
script.elementum.nova
Multi-provider for russian tracker for Elementum. Python 2 version. Development stopped.
Stars: ✭ 33 (-21.43%)
Mutual labels:  nova
nova-telescope-link
Smart Link for Laravel Nova to Telescope Debug Assistant.
Stars: ✭ 37 (-11.9%)
Mutual labels:  nova
nova-help
A custom help/title field for Laravel Nova
Stars: ✭ 51 (+21.43%)
Mutual labels:  nova
Chrome.RTSP.Player
Chrome RTSP player
Stars: ✭ 135 (+221.43%)
Mutual labels:  media
mediafeed
Web application to help categorize and aggregate subscriptions of media channels for easy access. (working only with Youtube channels at this moment)
Stars: ✭ 15 (-64.29%)
Mutual labels:  media
playercast
Cast to media player and control playback remotely.
Stars: ✭ 46 (+9.52%)
Mutual labels:  media
Director
Director is a facility scale broadcast orchestration and control suite. Not actively maintained
Stars: ✭ 35 (-16.67%)
Mutual labels:  media
Dockerfiles
Optimized media, analytics and graphics software stack images. Use the dockerfile(s) in your project or as a recipe book for bare metal installation.
Stars: ✭ 98 (+133.33%)
Mutual labels:  media
nova-maintenance-mode
Maintenance Mode for Laravel Nova
Stars: ✭ 37 (-11.9%)
Mutual labels:  nova
page capture
A Chrome Extension that allows page capturing from within your Web Application.
Stars: ✭ 13 (-69.05%)
Mutual labels:  media

Laravel Nova Media Library

Attention: Please consider using this package instead, it has a lot more support for various medialibrary features, and will probably fit your needs better!

This package is designed to be used with the awesome media library package from Spatie. With this package you can add an image field for uploading single files to a resource, a generic file field for other types, and add an images field to resources to display all of their associated media.

use Kingsley\NovaMediaLibrary\Fields\Image;

Image::make('Avatar', 'avatar')
    ->usingConversion('thumb')
    ->preservingOriginal()

In this example we're defining a field called Avatar that uses the avatar collection. It's also calling usingConversion to set the thumb conversion as the image to be displayed (on detail and index). The other methods called are dynamically applied to the upload request - this lets you call any media-library method on the field..

If you want it to remove the old image before uploading the new one, be sure to make your model's media collection a single file collection.

When you want to upload a file that isn't an image, you can use the rudimentary File field included with this package. It follows the same format as registering an Image field.

use Kingsley\NovaMediaLibrary\Fields\File;

File::make('Invoice', 'invoice')

That's all there is to it! The rest of the configuration should be done in the media collection itself, such as:

public function registerMediaCollections()
{
    $this
        ->addMediaCollection('invoice')
        ->singleFile()
        ->acceptsFile(function (File $file) {
            return $file->mimeType === 'application/pdf';
        });
}

To show all media records for your resource simply add the Images field like so:

use Kingsley\NovaMediaLibrary\Fields\Images;

public function fields(Request $request)
{
    return [
        ...
        Images::make(),
    ];
}

This will automatically use the media attribute on your model (which the HasMediaTrait adds).

Note: You currently cannot create media directly from Nova.

Registering the media resource

If you'd like to use the media resource included with this package, you need to register it manually in your NovaServiceProvider in the boot method.

Nova::resources([
    \Kingsley\NovaMediaLibrary\Resources\Media::class
]);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].