purplespider/silverstripe-basic-gallery-extension

Silverstripe CMS Image Gallery Extension

4.0.3 2023-09-20 12:48 UTC

This package is auto-updated.

Last update: 2024-10-20 15:18:48 UTC


README

Introduction

Add this extension to any page type, to get the following batch image upload interface in the CMS:

Screenshot

It allows images to be bulk uploaded, drag and drop reordering and inline caption adding.

Or use the following modules:

Maintainer Contact

Requirements

  • Silverstripe 5

Installation Instructions

Install: Until this PR is merged: Add to composer.json:

    "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/purplespider/GridFieldBulkEditingTools"
    }
  ],

Add to require:

"colymba/gridfield-bulk-editing-tools": "dev-ss5-fix-json2array as 4.0",

Then install this module:


composer require purplespider/silverstripe-basic-gallery-extension ^4

v3 Upgrade Notes

Upgrading to v3 will break existing galleries due to a change to a polymorphic relation, to fix:

  1. Run dev/build
  2. Run /dev/tasks/upgrade-basic-galleries script.

Config

The Extension can be applied to any page type to enable the gallery functionality.

You can also customise the CMS tab that the gallery appears on, as well as the title of the gallery displayed in the CMS, and rename the main Content tab:

---
Name: custom-basic-gallery-extension
After: basic-gallery-extension
---
HomePage:
    extensions:
        - PurpleSpider\BasicGalleryExtension\PhotoGalleryExtension
    gallery-title: Image Gallery
    gallery-cms-tab: Main
    content-cms-tab: Top Content

Automatically Delete Image Files

To automatically delete image files when an image is deleted from a gallery:

---
Name: custom-basic-gallery-extension
After: basic-gallery-extension
---
PurpleSpider\BasicGalleryExtension\PhotoGalleryImage:
    ondelete_delete_image_files: true

This uses Delete Asset If Unused Extension to detect if the image is being used elsewhere on the site, and will only delete it if it isn't. There are caveats though, so check this module's readme, i.e. you might not want to use this on sites that have been upgraded from Silverstripe 3.