From ca7a92fdea75eb6699c608c0fdf643b2590579ea Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 19:04:38 +0600 Subject: [PATCH 1/9] fix: typo --- src/MediaUploader.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MediaUploader.php b/src/MediaUploader.php index 54bdbc1..f831ff3 100644 --- a/src/MediaUploader.php +++ b/src/MediaUploader.php @@ -125,7 +125,7 @@ public function toCollection(string $name) */ public function setFileName(string $fileName) { - $this->fileName = $this->sanitiseFileName($fileName); + $this->fileName = $this->sanitizeFileName($fileName); return $this; } @@ -140,12 +140,12 @@ public function useFileName(string $fileName) } /** - * Sanitise the file name. + * Sanitize the file name. * * @param string $fileName * @return string */ - protected function sanitiseFileName(string $fileName) + protected function sanitizeFileName(string $fileName) { return str_replace(['#', '/', '\\', ' '], '-', $fileName); } From 9628e7fc750719c24aa7c2c224164166a97fa05a Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 19:21:46 +0600 Subject: [PATCH 2/9] update: symbolic link note --- README.md | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2c1a264..149e0d4 100644 --- a/README.md +++ b/README.md @@ -80,19 +80,30 @@ php artisan migrate ## Configuration -MediaMan works out of the box. If you want to tweak it, MediaMan ships with a config/mediaman.php. One common need of tweaking could be to store media in a dedicated Storage. +MediaMan works out of the box. If you want to tweak it, MediaMan ships with a `config/mediaman.php`. One common need of tweaking could be to store media in a dedicated Storage. -MediaMan supports all of the storage drivers that are supported by Laravel. For i.e. Let's configure a local media disk for MediaMan. +MediaMan supports all of the storage drivers that are supported by Laravel (for i.e. Local, S3, SFTP, FTP, Dropbox & so on). + +Here's an example configuration to use a dedicated local media disk for MediaMan. ```php // file: config/filesystems.php -// add the lines in the disks array -'media' => [ - 'driver' => 'local', - 'root' => storage_path('app/media'), - 'url' => env('APP_URL') . '/media', - 'visibility' => 'public', - ], +// define a new disk +'disks' => [ + ... + 'media' => + 'driver' => 'local', + 'root' => storage_path('app/media'), + 'url' => env('APP_URL') . '/media', + 'visibility' => 'public', + ], +] + +// define the symbolic link +'links' => [ + ... + public_path('media') => storage_path('app/media'), +], // file: config/mediaman.php From 4addebf56214be01d2ee7defad16d86af3cfa011 Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 20:03:57 +0600 Subject: [PATCH 3/9] update: intro section --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 149e0d4..cf483c5 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,9 @@

# Laravel MediaMan -The most elegant & powerful media management package for Laravel! - - +MediaMan is an elegant & powerful media management package for any Laravel App with support for painless `uploader`, virtual `collection` & automatic `conversion` plus an on demand `association` with specific broadcasting `channel`s of your app models. +MediaMan is UI agnostic & provides a fluent API to manage your app's media, which means you've total control over your media, the look & feel & a hassle free dev experience. It's a perfect suit for your App or API server. ## In a hurry? Here's a quick example: @@ -21,7 +20,7 @@ $media = MediaUploader::source($request->file->('file')) ->upload(); $post = Post::find(1); -$post->attachMedia($media, 'featured-image'); +$post->attachMedia($media, 'featured-image-channel'); ``` @@ -34,13 +33,13 @@ There are a few key concepts that need to be understood before continuing: * **MediaUploader**: Media items are uploaded as its own entity. It does not belong to any other model in the system when it's being created, so items can be managed independently (which makes it the perfect engine for a media manager). MediaMan provides "MediaUploader" for creating records in the database & storing in the filesystem as well. -* **MediaCollection**: Media items can be bundled to any "collection". Media & Collections will form many-to-many relation. You can use it to create groups of media without really associating media to your App Models. +* **MediaCollection**: Media items can be bundled to any "collection". Media & Collections will form many-to-many relation. You can create collections / virtual directories / groups of media & later on retrieve a group to check what it contains or do. -* **Association**: Media need be attached to a model for an association to be made. MediaMan exposes helpers to easily get the job done. Many-to-many polymorphic relationships allow any number of media to be associated to any number of other models without the need of modifying their schema. +* **Association**: Media items need be attached to a model for an association to be made. MediaMan exposes helpers to easily get the job done. Many-to-many polymorphic relationships allow any number of media to be associated to any number of other models without the need of modifying the existing database schema. -* **Channel**: Media items are bound to a "channel" of a model during association. Thus you can easily associate multiple types of media to a model. For example, a "User" model might have an "avatar" and a "documents" media channel. +* **Channel**: Media items are bound to a "channel" of a model during association. Thus you can easily associate multiple types of media to a model. For example, a "User" model might have an "avatar" and a "documents" media channel. If your head is spinning, simply think of "channels" as :tags" for a specific model. Channels are also needed to perform conversions. -* **Conversion**: You can manipulate images using conversions, conversions will be performed when a media item (image) is associated to a model. For example, you can register a "thumbnail" conversion to run when images are attached to the "gallery" channel of a model. +* **Conversion**: You can manipulate images using conversions, conversions will be performed when a media item is associated to a model. For example, you can register a "thumbnail" conversion to run when images are attached to the "gallery" channel of a model. From 97d7d5dc31722c89df6ce6dcc634c901efb7e42c Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 20:26:21 +0600 Subject: [PATCH 4/9] add: requirements section --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cf483c5..1a47213 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,12 @@ There are a few key concepts that need to be understood before continuing: +## Requirements + +- PHP v7.3 | v7.4 | v8.0 +- Laravel v7 | v8 +- Composer v1 | v2 + ## Installation You can install the package via composer: @@ -62,7 +68,7 @@ You can install the package via composer: ```bash composer require farhanshares/laravel-mediaman ``` -The package should be auto discovered by Laravel unless you've disabled auto-discovery mode. In that case, add the service provider to your config/app.php file: +The package should be auto discovered by Laravel unless you've disabled auto-discovery mode. In that case, add the service provider to your config/app.php: `FarhanShares\MediaMan\MediaManServiceProvider::class` From 52820362c45c3680ae5676aeb6ff3f142b91795e Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 21:22:22 +0600 Subject: [PATCH 5/9] add: what's unique section --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 1a47213..90bfb5c 100644 --- a/README.md +++ b/README.md @@ -487,5 +487,24 @@ $mediaOneThumb = $media[0]->getUrl('thumb'); *Tip:* The `media_url` is always appended & it's the original media URL. + +## What's unique? Why use this package? + +Most of the Laravel app deals with media / files at some point of it's development cycle. I was enjoying [Spatie's Laravel MediaLibrary](https://github.com/spatie/laravel-medialibrary). Then I found [Optix's Laravel Media](https://github.com/optixsolutions/laravel-media), which is a good one too. Both has differences with pros & cons. + +I was searching for a solution to suit my needs & ended up developing the package. It's highly inspired from the above two packages. MediaMan is lightweight, elegant & featureful. It can be used as simple hassle-free media attachment-detachment solution for any model or it can be a powerful media manager's backend. It'll continue to receive updates whenever needed.. + + +| Comparison | Spatie | Optix | MediaMan | +|-----------------------------------|---------------------|----------------|-----------------| +| **Relationship type** | One to many | Many to many | Many to many | +| **Reuse media with another model**| No | Yes | Yes | +| **Virtual directory** | No | No | Yes | +| **Auto delete media with model** | Yes | No | Yes | +| **Image manipulation** | Yes | Yes | Yes | +| **Manipulation type** | Specific to a model | Global registry| Global registry | + + +If you encounter a bug, please consider opening an issue. Feature Requests & PRs are welcome. ## License The MIT License (MIT). Please read [License File](LICENSE.md) for more information. From be1198d39986f47d41dc4e57ba34a1bd211c0e79 Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 21:25:56 +0600 Subject: [PATCH 6/9] update: intro --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90bfb5c..38a4638 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@

# Laravel MediaMan -MediaMan is an elegant & powerful media management package for any Laravel App with support for painless `uploader`, virtual `collection` & automatic `conversion` plus an on demand `association` with specific broadcasting `channel`s of your app models. +MediaMan is an elegant & powerful media management package for Laravel Apps with support for painless `uploader`, virtual `collection` & automatic `conversion` plus an on demand `association` with specific broadcasting `channel`s of your app models. MediaMan is UI agnostic & provides a fluent API to manage your app's media, which means you've total control over your media, the look & feel & a hassle free dev experience. It's a perfect suit for your App or API server. From 933af42fe01d2c591e1a7e971ecae0e27d09692d Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 21:28:41 +0600 Subject: [PATCH 7/9] update: toc & requirements section --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 38a4638..c4e4d70 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ There are a few key concepts that need to be understood before continuing: ## Table of Contents + * [Requirements](#requirements) * [Installation](#installation) * [Configuration](#configuration) * [Media](#media) @@ -55,7 +56,7 @@ There are a few key concepts that need to be understood before continuing: -## Requirements +### Requirements - PHP v7.3 | v7.4 | v8.0 - Laravel v7 | v8 From e35570a74dd301c6133d0a35b5741edd4011eb75 Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 21:30:11 +0600 Subject: [PATCH 8/9] update: toc & what's unique section --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c4e4d70..6fbecbc 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ There are a few key concepts that need to be understood before continuing: * [Collections](#collections) * [Media & Collections](#media--collections) * [Media, Models & Conversions](#conversions) + * [What's unique?](#whats-unique-why-use-this-package) @@ -489,7 +490,7 @@ $mediaOneThumb = $media[0]->getUrl('thumb'); *Tip:* The `media_url` is always appended & it's the original media URL. -## What's unique? Why use this package? +### What's unique? Why use this package? Most of the Laravel app deals with media / files at some point of it's development cycle. I was enjoying [Spatie's Laravel MediaLibrary](https://github.com/spatie/laravel-medialibrary). Then I found [Optix's Laravel Media](https://github.com/optixsolutions/laravel-media), which is a good one too. Both has differences with pros & cons. From 1d4994fea96577f78e9cf4ca5c169853c8cfe1a8 Mon Sep 17 00:00:00 2001 From: Farhan Israq Date: Sat, 3 Apr 2021 21:32:45 +0600 Subject: [PATCH 9/9] update: comparison table --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6fbecbc..bfa1e11 100644 --- a/README.md +++ b/README.md @@ -497,14 +497,14 @@ Most of the Laravel app deals with media / files at some point of it's developme I was searching for a solution to suit my needs & ended up developing the package. It's highly inspired from the above two packages. MediaMan is lightweight, elegant & featureful. It can be used as simple hassle-free media attachment-detachment solution for any model or it can be a powerful media manager's backend. It'll continue to receive updates whenever needed.. -| Comparison | Spatie | Optix | MediaMan | -|-----------------------------------|---------------------|----------------|-----------------| -| **Relationship type** | One to many | Many to many | Many to many | -| **Reuse media with another model**| No | Yes | Yes | -| **Virtual directory** | No | No | Yes | -| **Auto delete media with model** | Yes | No | Yes | -| **Image manipulation** | Yes | Yes | Yes | -| **Manipulation type** | Specific to a model | Global registry| Global registry | +| Comparison | Spatie | Optix | MediaMan | +|-----------------------------------|---------------------|----------------|---------------------| +| **Relationship type** | One to many | Many to many | **Many to many** | +| **Reuse media with another model**| No | Yes | **Yes** | +| **Virtual directory** | No | No | **Yes** | +| **Auto delete media with model** | Yes | No | **Yes** | +| **Image manipulation** | Yes | Yes | **Yes** | +| **Manipulation type** | Specific to a model | Global registry| **Global registry** | If you encounter a bug, please consider opening an issue. Feature Requests & PRs are welcome.