sebastienheyd / boilerplate-media-manager
Media Manager for sebastienheyd/boilerplate
Installs: 2 655
Dependents: 1
Suggesters: 1
Security: 0
Stars: 6
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- intervention/image: ^3.0
- sebastienheyd/boilerplate: ^8.0|dev-master
Requires (Dev)
- doctrine/dbal: ^3.0
- orchestra/testbench: ^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0|^12.0
- squizlabs/php_codesniffer: ^3.0
Suggests
- sebastienheyd/boilerplate-email-editor: Visual editor for e-mails for sebastienheyd/boilerplate
- sebastienheyd/boilerplate-packager: Package manager for sebastienheyd/boilerplate
- dev-master
- 8.0.0
- 7.3.4
- 7.3.3
- 7.3.2
- 7.3.1
- 7.3.0
- 7.2.1
- 7.2.0
- 7.1.5
- 7.1.4
- 7.1.3
- 7.1.2
- 7.1.1
- 7.1.0
- 7.0.11
- 7.0.10
- 7.0.9
- 7.0.8
- 7.0.7
- 7.0.6
- 7.0.5
- 7.0.4
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.5.1
- 6.5.0
- 6.4.1
- 6.3.1
- 6.3.0
- 6.2.0
- 6.1.0
- 6.0.x-dev
- 6.0.0
- 5.8.x-dev
- 5.8.0
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.0
- dev-analysis-QMMOm6
- dev-analysis-9mmbBw
- dev-selector
- dev-analysis-x0lEM0
- dev-analysis-Rvx0D7
This package is auto-updated.
Last update: 2025-05-24 06:53:01 UTC
README
This package adds a media management tool to sebastienheyd/boilerplate
Installation
- In order to install Laravel Boilerplate Media Manager run :
composer require sebastienheyd/boilerplate-media-manager
- Run the migration to add permissions
php artisan migrate
- Create the symbolic link from
public/storage
tostorage/app/public
php artisan storage:link
Optional:
To publish configuration files, you can run:
php artisan vendor:publish --tag=boilerplate
Configuration
After vendor:publish
, you can find the configuration file mediamanager.php
in the app/config/boilerplate
folder
configuration | description |
---|---|
mediamanager.base_url | Relative path to the public storage folder |
mediamanager.tinymce_upload_dir | Directory where TinyMCE will store his edited image |
mediamanager.thumbs_dir | Directory where to store dynamically generated thumbs |
mediamanager.authorized.size | Upload max size in bytes, default is 2048 |
mediamanager.authorized.mimes | Mime types by extension, see Laravel documentation |
mediamanager.filetypes | Associative array to get file type by extension |
mediamanager.icons | Associative array to get icon class (Fontawesome) by file type |
mediamanager.filter | Array of filtered files to hide |
Backend
TinyMCE
This media manager will be automatically used for images and files inclusion by the TinyMCE Blade component included with the sebastienheyd/boilerplate package.
Image selector
You can use the <x-boilerplate-media-manager::image>
component to easily insert an image selector into your forms.
This component allows you to use the media manager to select an image to use.
<x-boilerplate-media-manager::image name="image">
Parameters are :
name | description | default |
---|---|---|
name | Input name (required) | "" |
value | Default input value | "" |
label | Label of the input field | "" |
width | Width of the selector | 300 |
height | Height of the selector | 200 |
help | Help text | "" |
group-class | Additional class to form-group | "" |
group-id | Form-group ID | "" |
File selector
You can use the <x-boilerplate-media-manager::file>
component to easily insert a file selector into your forms.
This component allows you to use the media manager to select a file to assign to the input field.
<x-boilerplate-media-manager::file name="file">
Parameters are :
name | description | default |
---|---|---|
name | Input name (required) | "" |
value | Input value | "" |
label | Label of the input field | "" |
type | Media list filter (all, file, image, video) | all |
help | Help text | "" |
group-class | Additional class to form-group | "" |
group-id | Form-group ID | "" |
Frontend
Img (fit or resize)
img
will dynamically resize an image and returns the URL using Intervention and Storage (public disk)
{!! img('/storage/my_picture.jpg', 100, 100, [], 'resize') !!}
will return
<img src="/storage/thumbs/resize/100x100/my_picture.jpg?1555331285" width="100" height="100">
Or using the @img
Blade directive :
@img('/storage/my_picture.jpg', 250, 150, ['class' => 'fluid-image'])
will return
<img src="/storage/thumbs/fit/250x150/my_picture.png?1555331285" width="250" height="150" class="fluid-image">
You can already get only the url by using img_url
helper function.
Clear cache
You can clear all resized image by using the artisan command thumbs:clear
php artisan thumbs:clear
Language
You can translate or change translations by running php artisan vendor:publish --tag=boilerplate-media-manager-lang
.
After running this command, you will find translations folders into resources/lang/vendor/boilerplate-media-manager
.
Copy one of the language folders in the new language you want to create and all you have to do is to translate. If you
want to share the language you have added, don't hesitate to make a pull request.
Views
You can override views by running php artisan vendor:publish --tag=boilerplate-media-manager-views
. You will then find
the views in the resources/views/vendor/boilerplate-media-manager
folder.