Gallery3x
--------------------
Author: Ivan Sergeevish K.
ivan@modxprofi.ru
https://modxprofi.ru
--------------------

Photos, videos, files and maps for MODX 3 resources.
Documentation: https://docs.ivan345.com/books/gallery3x

Requirements
- MODX 3.0 or newer
- PHP 8.1 or newer
- Imagick or GD extension
- pdoTools for Fenom chunks. The installer tries to install it automatically. If that fails, an error appears in the install log: install pdoTools from the Installer yourself.

Features
- Tabs in the resource editor: images, videos, files, embeds.
- Drag-and-drop upload (JPG, PNG, GIF, WebP, AVIF), any set of thumbnail sizes, WebP conversion, watermark and filters.
- Video from YouTube, Rutube, Vimeo, Dailymotion, Coub, OK.ru, Dzen, Kinescope, VK.
- Yandex Maps, Google Maps and custom embed code.
- Drag-and-drop sorting, bulk actions, groups, extra fields, an insert button for CKEditor and TinyMCE.
- Different media sources for different templates (gallery3x.source_map).

Installation
1. Go to Extras > Installer, install the package.
2. Go to Settings > System Settings, select the gallery3x namespace.
3. Enter template IDs separated by commas in gallery3x.templates. Without it, the tabs do not appear.
4. Enable the tabs you need: gallery3x.video_enable, gallery3x.files_enable, gallery3x.embed_enable. Enable the editor button with gallery3x.rte_enable. The image tab is always on.
5. Clear the cache and open a resource with one of these templates.

Thumbnail sizes are set in Media > Media Sources > Gallery3x Source, in the gallery3x_thumbnails property. Run "Regenerate" after changing them.

Snippets
[[!Gallery3x]]            images
[[!Gallery3xVideos]]      videos
[[!Gallery3xFiles]]       file attachments
[[!Gallery3xEmbeds]]      maps and embeds
[[!Gallery3xMixed]]       photos and videos together
[[!g3xGetImage? &input=`5` &options=`medium`]]   URL of one image, also works as an output modifier: [[+id:g3xGetImage=`small`]]
g3xCollectionsThumbnail   renderer for Collections

Common parameters
&resource       resource ID, the current one by default
&resources      list of resource IDs, a negative ID excludes
&parents        take records from child resources
&group          groups separated by commas
&limit, &offset
&sortby         model field or RAND(), &sortdir ASC or DESC
&showInactive   1 to include disabled records
&where          extra conditions in JSON
&source         media source ID or name for URLs
&fenom          1 to render through pdoTools Fenom
&tplOuter       wrapper chunk
&debug          1 to print the data

Gallery3x: &tplThumb item chunk, &ids list of image IDs.
Gallery3x and Gallery3xFiles: &return ids, json or data, &toPlaceholder.
Gallery3xVideos, Gallery3xFiles, Gallery3xEmbeds: &tplItem item chunk.
Gallery3xMixed takes only &resource, &limit, &offset, &sortby, &sortdir, &showInactive and &source from the list above, plus &tpl chunk, &groupBy field or empty, &thumbSize, &mixOrder (1 shared order, 0 images first, then videos).

Examples
[[!Gallery3x? &tplOuter=`tpl.Gallery3x.carousel.outer` &tplThumb=`tpl.Gallery3x.carousel.item`]]
[[!Gallery3x? &fenom=`1` &tplOuter=`tpl.Gallery3x.Fancybox.GridOuter.fenom`]]
[[!Gallery3xVideos? &fenom=`1` &tplOuter=`tpl.Gallery3x.Video.embedded.fenom`]]
[[!Gallery3xFiles? &fenom=`1` &tplOuter=`example.Gallery3x.Files.Table.fenom`]]
[[!Gallery3xMixed? &groupBy=`` &limit=`12`]]

The component does not load frontend libraries. For the Fancybox and lightGallery chunks, include the library in your site template.

Uninstalling
Database tables and uploaded files are kept.

License
GNU GPL v2. See license.txt.


--------------------
РУССКИЙ
--------------------

Фото, видео, файлы и карты для ресурсов MODX 3.
Документация: https://docs.ivan345.com/books/gallery3x

Требования
- MODX 3.0 и новее
- PHP 8.1 и новее
- Расширение Imagick или GD
- pdoTools для чанков на Fenom. Установщик пытается поставить его автоматически. Если не получилось, в журнале установки появится ошибка: установите pdoTools через Установщик сами.

Возможности
- Вкладки в карточке ресурса: изображения, видео, файлы, встраиваемые объекты.
- Загрузка перетаскиванием (JPG, PNG, GIF, WebP, AVIF), любой набор размеров превью, перевод в WebP, водяной знак и фильтры.
- Видео с YouTube, Rutube, Vimeo, Dailymotion, Coub, Одноклассников, Дзена, Kinescope, ВКонтакте.
- Яндекс.Карты, Google Карты и произвольный код для встраивания.
- Сортировка перетаскиванием, групповые действия, группы, дополнительные поля, кнопка вставки в CKEditor и TinyMCE.
- Разные источники файлов для разных шаблонов (gallery3x.source_map).

Установка
1. Откройте Пакеты > Установщик и установите пакет.
2. Откройте Настройки > Системные настройки, выберите пространство имён gallery3x.
3. Впишите ID шаблонов через запятую в gallery3x.templates. Без этого вкладки не появятся.
4. Включите нужные вкладки: gallery3x.video_enable, gallery3x.files_enable, gallery3x.embed_enable. Кнопку в редакторе включает gallery3x.rte_enable. Вкладка изображений включена всегда.
5. Очистите кеш и откройте ресурс с одним из этих шаблонов.

Размеры превью задаются в разделе Медиа > Источники файлов > Gallery3x Source, в свойстве gallery3x_thumbnails. После изменения запустите перегенерацию.

Сниппеты
[[!Gallery3x]]            изображения
[[!Gallery3xVideos]]      видео
[[!Gallery3xFiles]]       вложения
[[!Gallery3xEmbeds]]      карты и встраиваемые объекты
[[!Gallery3xMixed]]       фото и видео вместе
[[!g3xGetImage? &input=`5` &options=`medium`]]   адрес одного изображения, работает и как модификатор: [[+id:g3xGetImage=`small`]]
g3xCollectionsThumbnail   рендерер для Collections

Общие параметры
&resource       ID ресурса, по умолчанию текущий
&resources      список ID ресурсов, отрицательный ID исключает
&parents        брать записи дочерних ресурсов
&group          группы через запятую
&limit, &offset
&sortby         поле модели или RAND(), &sortdir ASC или DESC
&showInactive   1, чтобы вывести и выключенные записи
&where          дополнительные условия в JSON
&source         ID или название источника файлов для адресов
&fenom          1, чтобы выводить через Fenom из pdoTools
&tplOuter       чанк-обёртка
&debug          1, чтобы показать данные

Gallery3x: &tplThumb чанк элемента, &ids список ID изображений.
Gallery3x и Gallery3xFiles: &return ids, json или data, &toPlaceholder.
Gallery3xVideos, Gallery3xFiles, Gallery3xEmbeds: &tplItem чанк элемента.
Gallery3xMixed из этого списка принимает только &resource, &limit, &offset, &sortby, &sortdir, &showInactive и &source, а также &tpl чанк, &groupBy поле или пусто, &thumbSize, &mixOrder (1 общий порядок, 0 сначала изображения, затем видео).

Примеры
[[!Gallery3x? &tplOuter=`tpl.Gallery3x.carousel.outer` &tplThumb=`tpl.Gallery3x.carousel.item`]]
[[!Gallery3x? &fenom=`1` &tplOuter=`tpl.Gallery3x.Fancybox.GridOuter.fenom`]]
[[!Gallery3xVideos? &fenom=`1` &tplOuter=`tpl.Gallery3x.Video.embedded.fenom`]]
[[!Gallery3xFiles? &fenom=`1` &tplOuter=`example.Gallery3x.Files.Table.fenom`]]
[[!Gallery3xMixed? &groupBy=`` &limit=`12`]]

Компонент не подключает библиотеки на сайте. Для чанков Fancybox и lightGallery подключите библиотеку в шаблоне сайта.

Удаление
Таблицы базы данных и загруженные файлы остаются.

Лицензия
GNU GPL v2. См. license.txt.
