SeanDowney\BackpackGalleryCrud
https://gitlab.com/seandowney/laravel-backpack-gallery-crud
Moved toAn admin interface to easily add/edit/remove Gallery, using Laravel Backpack.
It uses Glide and provides helper methods to serve the images in frontend blade templates.
Install
- In your terminal:
$ composer require seandowney/backpackgallerycrud
- If your Laravel version does not have package autodiscovery then add the service provider to your config/app.php file:
Cviebrock\EloquentSluggable\ServiceProvider::class,
SeanDowney\BackpackGalleryCrud\GalleryCRUDServiceProvider::class,
- Publish the config file & run the migrations
$ php artisan vendor:publish --provider="SeanDowney\BackpackGalleryCrud\GalleryCRUDServiceProvider" #publish config, view and migration files
$ php artisan migrate #create the gallery table
- Configuration of file storage in
config/filesystems.php
.
'galleries' => [
'driver' => 'local',
'root' => storage_path('app/galleries'),
],
- Configuration of file storage in config/elfinder.php:
'roots' => [
[
'driver' => 'GalleryCrudLocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../storage/app/galleries', // path to files - relative to `public` (REQUIRED)
'URL' => '/galleries', // URL to files (REQUIRED)
'accessControl' => 'Barryvdh\Elfinder\Elfinder::checkAccess',
'autoload' => true,
'tmbPath' => '',
'tmbSize' => 150,
'tmbCrop' => false,
'tmbBgColor' => '#000',
],
],
- [Optional] Configuration of Glide image path in
config/seandowney/gallerycrud.php
.
'glide_path' => 'image',
- [Optional] Add a menu item for it in resources/views/vendor/backpack/base/inc/sidebar.blade.php or menu.blade.php:
<li><a href="{{ url(config('backpack.base.route_prefix', 'admin').'/gallery') }}"><i class="fa fa-picture-o"></i> <span>Gallery</span></a></li>
How to use the package
This package relies heavily on the elFinder
File Manager in Bakpack.
- First create a gallery
- In your galleries folder (the
path
setting in yourconfig/elfinder.php
roots), create a folder with the same name as theslug
in your gallery record. - Upload image files into the folder
- Now you can edit the gallery and the images are visible
- You can add captions and include the images in the gallery or not
- To remove images from the gallery
- uncheck the
Include
checkbox - then in the file manager remove the file from the folder for that gallery
- uncheck the
- Helper methods are now available to load the images using Glide.
gallery_image_url
will load images from a gallery eggallery_image_url($item['image_path'].'?w=300&h=200')
image_url
can be used where the images is from abrowse
field type so it may already include the disk path
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
// TODO
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email sean at considerweb dot com instead of using the issue tracker.
Credits
- Seán Downey - Lead Developer
- All Contributors
License
The MIT License (MIT). Please see License File for more information.