Code Monkey home page Code Monkey logo

laravel-backpack-gallery-crud's Introduction

SeanDowney\BackpackGalleryCrud

Moved to https://gitlab.com/seandowney/laravel-backpack-gallery-crud

Latest Version on Packagist Software License Total Downloads

An 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

  1. In your terminal:
$ composer require seandowney/backpackgallerycrud
  1. 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,
  1. 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
  1. Configuration of file storage in config/filesystems.php.
'galleries' => [
    'driver' => 'local',
    'root' => storage_path('app/galleries'),
],
  1. 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',
    ],
],
  1. [Optional] Configuration of Glide image path in config/seandowney/gallerycrud.php.
'glide_path' => 'image',
  1. [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 your config/elfinder.php roots), create a folder with the same name as the slug 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
  • Helper methods are now available to load the images using Glide.
    • gallery_image_url will load images from a gallery eg gallery_image_url($item['image_path'].'?w=300&h=200')
    • image_url can be used where the images is from a browse 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

License

The MIT License (MIT). Please see License File for more information.

laravel-backpack-gallery-crud's People

Contributors

jastkast avatar seandowney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

laravel-backpack-gallery-crud's Issues

No option to upload images

I have no ability to upload images - looking at the code it only says to show the table with the ability to order gallery items if there are photos already in the row in the database.

Composer: requirements cannot be resolved.

When trying to add this package through composer, I get the following error message. What is the solution for this? :


  Problem 1
    - backpack/crud 3.2.x-dev requires barryvdh/laravel-elfinder ^0.3.10 -> satisfiable by barryvdh/laravel-elfinder[v0.3.10, v0.3.11, v0.3.12] but these conflict with your requirements or minimum-stability.
    - backpack/crud 3.1.x-dev requires barryvdh/laravel-elfinder ^0.3.10 -> satisfiable by barryvdh/laravel-elfinder[v0.3.10, v0.3.11, v0.3.12] but these conflict with your requirements or minimum-stability.
    - Can only install one of: backpack/crud[3.6.x-dev, 4.0.35].
    - Can only install one of: backpack/crud[4.0.35, 3.6.x-dev].
    - Can only install one of: backpack/crud[3.6.x-dev, 4.0.35].
    - seandowney/backpackgallerycrud 1.1.0 requires backpack/crud ^3.0.6 -> satisfiable by backpack/crud[3.1.x-dev, 3.2.x-dev, 3.6.x-dev].
    - Installation request for seandowney/backpackgallerycrud ^1.1 -> satisfiable by seandowney/backpackgallerycrud[1.1.0].
    - Installation request for backpack/crud (locked at 4.0.35, required as 4.0.*) -> satisfiable by backpack/crud[4.0.35].


Installation failed, reverting ./composer.json to its original content.```


Cannot Upload Images

I am trying to use the gallery_table.blade field in a custom Backpack crud. After getting past a few obstacles, i'm at the point where no errors served, however, i'm not seeing the repeatable inputs to upload images/captions.

This is happening in both GalleryCrudController.php and my own custom ListingCrudController.php

I've seen previous issues raised by other users regarding this same problem, you replied that we must create a folder, matching the name of the slug, to get the input fields to appear. I am having no success with this approach. I only see the field label Images.

  1. Are we expected to create a folder before making a new gallery?
  2. Do you have any other suggestions for troubleshooting this?

You've created such an important field type, it'd be a shame for it to not work.

Thank you.

ErrorException

syntax error, unexpected 'image' (T_STRING), expecting ',' or ')' (View: .../resources/views/vendor/backpack/crud/fields/gallery_table.blade.php)

Error 403 on save new gallery form

Hello,

may be a config issue, but I don't find where I missed something.
When I save the form of my new gallery I have a 403 error...

May be you can help me ?

Thx

How it work?

Hi seandowney,
I already installed plugin but it is not work.
image

It only show label of gallery_table field.
I checked your code, it just show images have been added in database. Does not has add button to upload new image.
image

Order the images

Allow the user to reorder the display of the images in the gallery.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.