Skip to main content

collective.click_to_zoom

PyPI PyPI - Python Version PyPI - Wheel PyPI - License PyPI - Status PyPI - Plone Versions CI Code Style GitHub contributors GitHub Repo stars

An add-on for Plone to make images inserted through the TinyMCE editor clickable and viewable in a bigger resolution

Features

collective.click_to_zoom provides a seamless, click-to-zoom (lightbox) effect for images embedded in Plone RichText fields.

When a user clicks on an inline image within the page content, the image smoothly expands to the center of the screen with a semi-transparent dark background, mimicking the popular "Medium-style" image zoom functionality.

Key features:

  • Zero Javascript dependencies: Uses lightweight Vanilla JS to handle the zoom effect without relying on heavy libraries (no jQuery, no NPM dependencies required).
  • Non-destructive Output Filter: Uses a backend Python output filter (ClickToZoomFilter) that safely wraps the <img> tags in an <a> tag pointing to a larger cacheable image scale, ensuring it doesn't break Plone's built-in image srcset functionalities.
  • Configurable: Includes a Plone Control Panel where administrators can:
    • Toggle the click-to-zoom effect globally (Enable/Disable).
    • Select the specific image scale to be used when zooming (e.g., large, great, huge), dynamically populated from Plone's existing image scales vocabulary.
    • Show original image: Option to link to the original image directly. When enabled, the JavaScript lightbox is bypassed and the browser handles the link (e.g. opens the image in the current tab).
  • Interactive Zoom & Pan: When the lightbox is active (standard scales), it supports advanced interactions:
    • Click-to-Zoom: Toggle between "Fit to Screen" and zoomed view.
    • Smooth Wheel Zoom: Use the mouse wheel to zoom in and out at the cursor position.
    • Drag-to-Pan: Click and drag to explore every detail of the image when zoomed in.
    • Resolution Aware: Automatically limits the maximum zoom level to the image's original resolution to prevent pixelation. If an image is smaller than the screen, zooming is automatically disabled.
    • Mobile Friendly: Supports touch gestures via modern Pointer Events.
  • ZCA compliant: The backend HTML parser is conditionally applied through an IBrowserLayer, ensuring zero overhead on sites where the add-on is not installed.
  • Graceful degradation: If an image is already manually wrapped in a hyperlink (e.g., the editor linked the image to a different page), the zoom filter will safely ignore it to preserve the author's intent.

Installation

Install collective.click_to_zoom with pip:

pip install collective.click_to_zoom

And to create the Plone site:

make create-site

Contribute

Prerequisites ✅

Installation 🔧

  1. Clone this repository, then change your working directory.

    git clone git@github.com:collective/collective.click_to_zoom.git
    cd collective.click_to_zoom
    
  2. Install this code base.

    make install
    

Add features using plonecli or bobtemplates.plone

This package provides markers as strings (<!-- extra stuff goes here -->) that are compatible with plonecli and bobtemplates.plone. These markers act as hooks to add all kinds of subtemplates, including behaviors, control panels, upgrade steps, or other subtemplates from plonecli.

To run plonecli with configuration to target this package, run the following command.

make add <template_name>

For example, you can add a content type to your package with the following command.

make add content_type

You can add a behavior with the following command.

make add behavior
You can check the list of available subtemplates in the [`bobtemplates.plone` `README.md` file](https://github.com/plone/bobtemplates.plone/?tab=readme-ov-file#provided-subtemplates).
See also the documentation of [Mockup and Patternslib](https://6.docs.plone.org/classic-ui/mockup.html) for how to build the UI toolkit for Classic UI.

Built with AI 🤖

This package was developed in collaboration with Google Gemini. The AI assisted in scaffolding the Plone output filters, writing the Vanilla JS lightbox, and configuring the Zope Component Architecture, which was then reviewed and curated by human developers.

License

The project is licensed under GPLv2.

Credits and acknowledgements 🙏

Generated using Cookieplone (1.0.0) and cookieplone-templates (f72da68) on 2026-03-30 09:05:27.109597. A special thanks to all contributors and supporters!


Changelog

1.2.0 (2026-07-30)

New features:

    • Added interactive pan and zoom to the lightbox.
    • Added "Show original image" option to the control panel. When enabled, the lightbox is bypassed and the browser handles the image link directly.
    • Added automatic zoom limit based on the original image resolution.
    • Added upgrade step to update the registry for existing installations. #zoom-and-pan

1.1.0 (2026-03-30)

New features:

  • eu and es translations @erral

1.0.0 (2026-03-30)

Internal:

  • Initial release @erral

Metadata

Release files for collective.click-to-zoom 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.click-to-zoom 1.2.0
File Size Uploaded Provenance Actions
collective_click_to_zoom-1.2.0.tar.gz 30.5 kB Without provenance Details for collective_click_to_zoom-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for collective.click-to-zoom 1.2.0
File Interpreter ABI Platform Actions
collective_click_to_zoom-1.2.0-py3-none-any.whl Python 3 none any Details for collective_click_to_zoom-1.2.0-py3-none-any.whl

Total release size: 68.0 kB

Release files / collective_click_to_zoom-1.2.0.tar.gz

Download URL collective_click_to_zoom-1.2.0.tar.gz
Size 30.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6ae92ea15b40b386cb90d1f244bfefaa65394a92cfc76fefc62bb44ab3cc25c5
BLAKE2b-256 checksum
How to use checksums
4f8902fe2073a3c4cc8cc1c4f9a12e0e52489f48ce15118416b55f960fb973d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Release files / collective_click_to_zoom-1.2.0-py3-none-any.whl

Download URL collective_click_to_zoom-1.2.0-py3-none-any.whl
Size 37.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ecb1264137ecf53f69674ae86830fc1a214db26f8306d6aeed4666bf2bce2f4
BLAKE2b-256 checksum
How to use checksums
05e94452ada500629bb2bd435695c74a31b00fc886b6acc560c8e01a3d2f3517
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.16

Security for collective.click-to-zoom 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page