=== RM24 Gallery ===
Contributors: agenturroth
Tags: gallery, lightbox, image gallery, webp, photo gallery
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fast image galleries with a built-in lightbox: CSS grid, responsive images, WebP upload optimisation, no jQuery, one-click import from FooGallery.

== Description ==

**RM24 Gallery** shows your images in a clean, responsive grid and opens them in a fast full-screen lightbox. It is built to be small: one stylesheet and one small script without jQuery or other libraries, loaded only on pages that actually show a gallery.

= Features =
* **Galleries in the admin area:** choose images from the media library, sort them by drag and drop, remove them with one click.
* **Settings per gallery:** columns for desktop, tablet and mobile (1–6), spacing, image ratio (original, 1:1, 4:3, 3:2, 16:9), image size, captions, lightbox on/off.
* **Fast frontend:** CSS grid, responsive images with `srcset`/`sizes`, `loading="lazy"` and `decoding="async"`, alt texts from the media library.
* **Built-in lightbox:** full screen, arrows, keyboard (← → Esc), swipe, counter "3 / 12", caption, focus trap and scroll lock. The large image is only loaded when the lightbox opens.
* **Block and shortcode:** the block "RM24 Gallery" with a live preview, `[rm24_gallery id="123"]`, or images without a saved gallery: `[rm24_gallery ids="1,2,3" columns="3"]`.
* **Image optimisation on upload (optional):** new images are reduced to a maximum size (default 2000 px), saved in web quality (default 80 %) and converted to WebP – before WordPress creates the image sizes.
* **Videos in the lightbox:** items with a video (provided by the PRO media pool) open a YouTube or Vimeo player in the lightbox; the player is only loaded on click.
* **Import from FooGallery:** creates an RM24 gallery for every FooGallery gallery and replaces the FooGallery blocks and shortcodes in your posts and pages – with a preview, a confirmation and a log. Works even when FooGallery is already deactivated.
* **Translations:** German (Switzerland, Germany – formal and informal), French and Italian. English is the base language.

= Switching from FooGallery and FooBox =
1. Install and activate RM24 Gallery.
2. Go to RM24 → Gallery settings → "Import from FooGallery".
3. Step 1: import the galleries. Step 2: show the preview, then replace the insertions in your posts and pages.
4. Check a few pages, then deactivate and delete FooGallery and FooBox.

= Shortcode attributes =
`columns`, `columns_tablet`, `columns_mobile` (1–6), `gap` (pixels), `ratio` (`original`, `1-1`, `4-3`, `3-2`, `16-9`), `size` (any image size, e.g. `medium`, `large`, `full`), `caption` (`yes`/`no`), `lightbox` (`yes`/`no`).

= RM24 Gallery PRO =
The separate PRO add-on (available at [rm24.ch](https://rm24.ch/produkt/rm24-gallery/)) adds masonry, justified and slider layouts, before/after comparisons with a slider, hover effects and caption styles, lightbox options (background colour, thumbnail strip, slideshow, direct links), filter buttons by image category, a media pool that shares images and YouTube/Vimeo videos between several websites, and an automatic, subtle watermark. This free plugin is fully functional on its own.

= For developers =
Filters: `rm24gal_layouts`, `rm24gal_settings_defaults`, `rm24gal_sanitize_settings`, `rm24gal_items`, `rm24gal_item`, `rm24gal_item_attributes`, `rm24gal_wrapper_classes`, `rm24gal_wrapper_style`, `rm24gal_wrapper_attributes`, `rm24gal_before_grid`, `rm24gal_pre_render`, `rm24gal_shortcode_settings`, `rm24gal_shortcodes`, `rm24gal_skip_optimize`. Actions: `rm24gal_enqueue_assets`, `rm24gal_metabox_pro`, `rm24gal_settings_top`, `rm24gal_settings_cards`, `rm24gal_admin_edit_assets`. The lightbox fires the events `rm24gal:open`, `rm24gal:change` and `rm24gal:close` and offers `window.RM24Gallery.open( element, index )`.

== Installation ==

1. Install the plugin through Plugins → Add New, or upload the plugin folder to `/wp-content/plugins/`.
2. Activate the plugin.
3. Go to RM24 → Galleries → "Add gallery", choose your images and publish.
4. Insert the gallery with the block "RM24 Gallery" or with the shortcode shown next to the gallery.

== Frequently Asked Questions ==

= Does the plugin load scripts on every page? =
No. The stylesheet and the lightbox script are only loaded on pages that show a gallery.

= Does it need jQuery? =
Not on the frontend. The gallery editor in the admin area uses the media library and the sortable list that ship with WordPress.

= Where do alt texts and captions come from? =
From the media library. Edit them there and every gallery shows the new texts.

= What happens to my images when I delete a gallery or the plugin? =
Images in the media library are never deleted. Galleries are only deleted with the plugin if you enabled "Also delete all galleries" in the settings.

= What does the upload optimisation change? =
When it is switched on (RM24 → Gallery settings), every new JPEG, PNG or WebP image is reduced to the maximum size and saved in the chosen quality, by default as WebP. The original upload is replaced by the optimised file. Existing images are not touched.

= Does a video load anything from YouTube or Vimeo before it is played? =
No. Video items show a preview image from your own media library and a play button. The YouTube (privacy-enhanced mode, youtube-nocookie.com) or Vimeo player (with "do not track") is only loaded when the visitor clicks the item.

= Can I undo the FooGallery replacement? =
Yes. WordPress saves a revision of every post or page that is changed, so you can restore the previous version. The import log lists every change.

== External services ==

The gallery itself does not use any external service: images, styles and scripts are loaded from your own site only.

**YouTube and Vimeo (video items only).** Galleries can contain video items (they are provided by the separate PRO add-on). Before a visitor clicks such an item, nothing is loaded from YouTube or Vimeo: the preview image comes from your own media library. Only after the click the video player is loaded in the lightbox from YouTube (privacy-enhanced mode, `https://www.youtube-nocookie.com`) or Vimeo (`https://player.vimeo.com`, with "do not track"). From then on the provider receives the visitor's IP address and the usual browser data, and may set cookies, as described in its own terms: YouTube / Google [Terms of Service](https://www.youtube.com/t/terms) and [Privacy Policy](https://policies.google.com/privacy); Vimeo [Terms of Service](https://vimeo.com/terms) and [Privacy Policy](https://vimeo.com/privacy). Galleries without video items never contact these services.

The RM24 overview page (RM24 → Overview) can show a list of further RM24 plugins. The list is only loaded after you click "Show more RM24 plugins". It is then requested from https://rm24.ch/plugin_updates/modules.json and cached for 12 hours. No data about your site or its visitors is sent; the request only contains the data every web request contains (such as your server's IP address).

The service is provided by RM24 | Roger Roth: [Terms and privacy policy](https://rm24.ch/datenschutzerklaerung/).

== Screenshots ==

1. Gallery editor with drag and drop sorting.
2. Gallery in a 4-column grid.
3. Lightbox with counter and caption.
4. Import from FooGallery with preview.

== Upgrade Notice ==

= 1.1.1 =
Maintenance release: includes the fixes of 1.0.1 (plain-text captions in the lightbox, safer FooGallery import).

= 1.1.0 =
New: optional image optimisation on upload (size, WebP, quality) and video support in the lightbox.

= 1.0.0 =
First release.

== Changelog ==

= 1.1.2 =
* Tidier admin menu: RM24 Gallery now has a single entry «Galleries» in the RM24 menu. Settings and the PRO media pool screens open as tabs on top of the gallery pages.

= 1.1.1 =
* Includes all fixes of 1.0.1 (released in parallel to 1.1.0): captions with formatting are shown as plain text in the lightbox, the FooGallery import no longer preselects galleries without images, code clean-up for the plugin check.
* Readme: short description shortened, "External services" now explains YouTube and Vimeo (player only loaded after a click).
* Tested with WordPress 7.1.

= 1.1.0 =
* New: optional image optimisation on upload – maximum size, quality and conversion to WebP.
* New: video items (YouTube, Vimeo) open in the lightbox; the player is only loaded on click.
* New: galleries can be rendered from prepared items (used by the PRO media pool).
* New: hooks `rm24gal_shortcodes`, `rm24gal_skip_optimize` and `rm24gal_settings_cards`.

= 1.0.1 =
* Fix: captions with formatting (e.g. `<em>`) are shown as plain text in the lightbox instead of showing the HTML tags.
* FooGallery import: galleries without images (e.g. dynamic sources) are no longer preselected, so their insertions are not replaced by an empty gallery by mistake.
* Code clean-up for the WordPress.org plugin check.
* Tested with WordPress 7.1.

= 1.0.0 =
* Initial release: galleries with CSS grid and lightbox, block and shortcode, import from FooGallery.
