drago-ex / project-gallery
Image gallery in the administration of Drago Project, for images in the content of articles and pages.
Package info
github.com/drago-ex/project-gallery
Type:drago-tools-resource
pkg:composer/drago-ex/project-gallery
Requires
- php: >=8.3 <9
- ext-gd: *
- ext-intl: *
- drago-ex/application: ^4.0
- drago-ex/component: ^3.0
- drago-ex/form: ^3.0
- drago-ex/project-auth: ^1.0 || ^2.0
- drago-ex/project-backend: ^1.0
- drago-ex/translator: ^4.0.1
- nette/application: ^3.2
- nette/di: ^3.2
- nette/http: ^3.3
- nette/utils: ^4.0
Requires (Dev)
- drago-ex/project-tools: ^1.0
- nette/tester: ^2.5
- phpstan/phpstan-nette: ^2.0
Suggests
- drago-ex/permission: Generates the access rules of the gallery administration (bin/create-gallery-permission).
- drago-ex/project-backend-ui: Administration layout; the gallery uses its content widget.
- drago-ex/project-permission: Role and permission management in the administration, which registers the generated providers.
Provides
None
Conflicts
None
Replaces
None
README
Image gallery in the administration of Drago Project, for images in the content of articles and pages.
Images are uploaded on one page and shown in a grid. Over an image appear three buttons: a full-size preview,
copying it to paste into the content, and deleting it. A switch above the images sets what is copied: the
Texy markup ([* /upload/gallery/photo.jpg *]) or only the path
(/upload/gallery/photo.jpg); the browser remembers the choice.
Requirements
- PHP >= 8.3, < 9
- PHP extensions GD and intl
- Drago Project
Installation
composer require drago-ex/project-gallery
Project Tools copies the files of the package into the project, where you adapt them. The gallery needs no database.
Assets
Register the Naja extension that copies the path or the markup of an image in assets/admin.js:
import GalleryCopy from './naja/gallery.js'; registerNajaExtensions( // ... GalleryCopy );
and the styles of the buttons in assets/admin.scss:
@import 'naja/gallery';
The browser copies to the clipboard only over HTTPS and on localhost; elsewhere the text is offered in a dialog.
Administration
{link :Backend:Gallery:}
The menu item comes from Backend/Gallery/7.menu.neon with
Backend UI.
Images are saved in www/upload/gallery/. An upload is resized to fit 1920 × 1920 px and gets a readable name
made from the original one (Můj obrázek.JPG → muj-obrazek.jpg), numbered when the name is taken. Up to 20
images of at most 8 MB can be uploaded at once. Add /www/upload/ to .gitignore.
Permissions
The rules are in Backend/Gallery/acl.neon (resource Backend:Gallery, the administrator only). The privileges
are default (the page with previews), upload and delete; the upload form and the delete buttons are shown
only to those who may use them. Project Permission gives them to
other roles, e.g. a role that only views and copies images with default.
The same file describes the privileges (permissionLabels) for the permissions page of Project Permission.