A media picker plugin for Filament Admin.

Last update: Jun 29, 2022

Filament Curator

A media picker plugin for Filament Admin.

‼️ This package is still in development

‼️ This package does not work with Spatie Media Library since it requires it's own media model.

Gallery View

Upload View

Button

Installation

Install the package via composer.

composer require awcodes/filament-curator

Install Filament Curator into your app. This will publish the necessary migration and Filament resources.

php artisan curator:install

If you are using a custom Filament Admin Theme, be sure to add this package to your tailwind.config.js file.

content: [
    ...
    "./vendor/awcodes/filament-curator/**/*.blade.php",
],

Image Sizes

By default Curator will generate image sizes for each uploaded image based on the sizes setting in the config file. If you want to disable image sizes completely then set the sizes key to an empty array.

'sizes' => [],

Usage

Include the MediaPicker button in your forms to trigger the modal and either select an existing image or upload a new one.

use FilamentCurator\Forms\Components\MediaPicker;

MediaPicker::make(string $fieldName)
    ->label(string $customLabel)

Media can also be related to models by simply adding the relationship to your model.

use FilamentCurator\Models\Media;

public function ogImage(): HasOne
{
    return $this->hasOne(Media::class, 'id', 'og_image');
}

To retrieve different sizes urls, Curator's Media model comes with a helper that takes in a size and returns the url for you. Sizes are based on your config settings.

If a size doesn't exist in your config, then it will return the full size image url.

// Assuming a relationship on a Meta model for ogImage...

$meta->ogImage->getSizeUrl('thumbnail');
$meta->ogImage->getSizeUrl('medium');
$meta->ogImage->getSizeUrl('large');

If you need additional functionality you can extend Curator's Media model with your own.

use FilamentCurator\Models\Media as CuratorMedia;

class Media extends CuratorMedia
{
    // ... custom methods and properties
}

Versioning

This projects follow the Semantic Versioning guidelines.

License

Copyright (c) 2022 Adam Weston and contributors

Licensed under the MIT license, see LICENSE.md for details.

GitHub

https://github.com/awcodes/filament-curator
Comments
  • 1. Change the path from where the images are served

    I'm trying to use the media picker and the images are stored in storage/app/public/media. I've created another folder for those images in public/assets and I want to get them from there. Is there any way to do that?

    File URL from the dashboard: http://127.0.0.1:8000/storage/media/6ab0b41f-8fba-406f-a652-2a5572a0554c.png

    Reviewed by Roxeen12 at 2022-06-23 12:15
  • 2. generateThumbs support for external disks

    Possible solution in Media model under generateThumbs:

    $image = Image::make(
        Storage::disk($this->record->disk)->url($media->filename)
    );
    
    ...
    
    Storage::disk($media->disk)->put(
    				$pathinfo["dirname"] .
    					"/" .
    					$pathinfo["filename"] .
    					"-" .
    					$name .
    					"." .
    					$media->ext,
    				$image->stream()
    			);
    
    
    Reviewed by jeffgreco13 at 2022-06-22 01:46
  • 3. Better support for disk IconColumn

    Currently, the cloud icon only appears if the disk is set to s3 or cloudinary. return in_array($state, ["cloudinary", "s3"]);

    Allow other disks to be included in the cloud list.

    Reviewed by jeffgreco13 at 2022-06-22 01:04
  • 4. Use config for acceptedFileTypes in MediaResource

    The config file has an option to set the acceptedFileTypes but the component still sets the types explicitly within MediaResource. Possible fix:

    Update:

    ->acceptedFileTypes([
        "image/jpeg",
        "image/png",
        "image/webp",
        "image/svg+xml",
        "application/pdf",
    ])
    

    To:

    ->acceptedFileTypes(config('filament-curator.accepted_file_types'))
    
    Reviewed by jeffgreco13 at 2022-06-22 00:55
  • 5. Thumbnail images for non-image mimetypes

    An option for later. Currently the thumbnail is broken if the media is anything but an image, since it's attempting to load it into the src="" attribute.

    Detect mimetype and return a standard icon representing the file.

    Reviewed by jeffgreco13 at 2022-06-22 00:51
  • 6. sizeForHumans returning incorrect unit value

    The current method attempts to divide the model's size attribute directly. This small adjustment returns the correct unit:

    
            public function sizeForHumans(int $precision = 1): string
    	{
    		$units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
    		$size = $this->size;
    		for ($i = 0; $size > 1024; $i++) {
    			$size /= 1024;
    		}
    
    		return round($size, $precision) . " " . $units[$i];
    	}
    
    
    Reviewed by jeffgreco13 at 2022-06-22 00:47
  • 7. generateThumbs being called on non-image types

    Within the created closure on the Media model, self::generateThumbs($media) is being called even if the mimetype is not an image (ie. PDF). This causes a fatal error with Intervention. Possible fix:

                    static::created(function (Media $media) {
    			$media->refresh();
    			if (str($media->type)->contains("image")) {
    				self::generateThumbs($media);
    			}
    		});
    
    Reviewed by jeffgreco13 at 2022-06-22 00:44
  • 8. Jgreco updates

    • https://github.com/awcodes/filament-curator/issues/7
    • https://github.com/awcodes/filament-curator/issues/6
    • https://github.com/awcodes/filament-curator/issues/5
    • https://github.com/awcodes/filament-curator/issues/4
    • https://github.com/awcodes/filament-curator/issues/3
    • https://github.com/awcodes/filament-curator/issues/2
    Reviewed by awcodes at 2022-06-22 17:26
A Laravel clone of the Javascript Flatpickr (Date picker) library
A Laravel clone of the Javascript Flatpickr (Date picker) library

A Laravel clone of the Javascript Flatpickr (Date picker) library Using this package you can add a beautiful date or datetime picker into your project

Jun 26, 2022
A convenient helper for using the laravel-seo package with Filament Admin and Forms
A convenient helper for using the laravel-seo package with Filament Admin and Forms

Combine the power of Laravel SEO and Filament PHP. This package is a convenient helper for using the laravel-seo package with Filament Admin and Forms

Jul 2, 2022
Admin user, role and permission management for Laravel Filament
Admin user, role and permission management for Laravel Filament

Filament Access Control Opinionated setup for managing admin users, roles and permissions within Laravel Filament Features Separate database table for

Jun 29, 2022
Access laravel log through Filament admin panel
Access laravel log through Filament admin panel

Access laravel log through Filament admin panel Features Syntax highlighting Quickly jump between start and end of the file Refresh log contents Clear

Jun 17, 2022
A simple profile management page for Filament. ✨
A simple profile management page for Filament. ✨

A simple profile page for Filament. This package provides a very simple Profile page that allows the current user to manage their name, email address

Jun 30, 2022
Add a general-purpose tools page to your Filament project. 🛠
Add a general-purpose tools page to your Filament project. 🛠

Add a general-purpose tools page to your Filament project. Installation You can install the package via Composer: composer require ryangjchandler/fila

May 15, 2022
The Most Popular JavaScript Calendar as a Filament Widget 💛
 The Most Popular JavaScript Calendar as a Filament Widget 💛

The Most Popular JavaScript Calendar as a Filament Widget ?? Features Accepts all configurations from FullCalendar Event click and drop events Upcomin

Jul 2, 2022
A single-field repeater for Filament. ⚡️

A single-field repeater for Filament. This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Insta

Mar 5, 2022
Easily interact and control your feature flags from Filament

Easily interact and control your feature flags from Filament

Jun 14, 2022
Build structured navigation menus in Filament.

Build structured navigation menus in Filament. This plugin for Filament provides a Navigation resource that allows to build structural navigation menu

Jul 2, 2022
A collection of reusable components for Filament.
A collection of reusable components for Filament.

A collection of reusable components for Filament. This package is a collection of handy components for you to use in all your Filament projects. It pr

Jun 29, 2022
Social login for Filament through Laravel Socialite
Social login for Filament through Laravel Socialite

Social login for Filament through Laravel Socialite Add OAuth login through Laravel Socialite to Filament. Installation You can install the package vi

Jun 25, 2022
Provides the missing range field for the Filament forms.
Provides the missing range field for the Filament forms.

The missing range field for the Filament forms. Installation You can install the package via composer: composer require yepsua/filament-range-field Pu

Jun 22, 2022
Configurable activity logger for filament.

Activity logger for filament Configurable activity logger for filament. Powered by spatie/laravel-activitylog Features You can choose what you want to

Jun 24, 2022
Add a progress bar column to your Filament tables.
Add a progress bar column to your Filament tables.

Add a progress bar column to your Filament tables. This package provides a ProgessColumn that can be used to display a progress bar in a Filament tabl

Jun 24, 2022
MediaDB is a web-based media streaming service written in Laravel and Vue.

MediaDB (API) MediaDB is a web-based media streaming service written in Laravel and Vue. The nginx-vod-module is used for on-the-fly repackaging of MP

Jun 14, 2022
Laravel API wrapper to interact fluently with your Janus Media Server

Laravel API wrapper to interact fluently with your Janus Media Server. Core server interactions, as well as the video room plugin included.

May 29, 2022
Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models.
Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked models.

Laravel Befriended Eloquent Befriended brings social media-like features like following, blocking and filtering content based on following or blocked

Jun 30, 2022
Flow package to synchronize metadata and binary data of imported Neos.Media assets

Wwwision.AssetSync Flow package to synchronize metadata and resources of imported Neos.Media assets Installation Install this package via: composer re

Feb 7, 2022