Search by

tei / photoswipe

j0nnybrav079

TYPO3 PhotoSwipe-Plugin for native image-enlargement

Package info

github.com/j0nnybrav079/photoswipe

Language:JavaScript

Type:typo3-cms-extension

pkg:composer/tei/photoswipe

Statistics

Installs: 3 716

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 1

3.1.0 2026-10-25 18:44 UTC

README

Native image enlargement and content layers powered by PhotoSwipe — plain JavaScript, no jQuery or other frameworks required.

Features

  • Image lightbox — images with "click to enlarge" open in the PhotoSwipe gallery. The image dimensions are added to the markup as data-pswp-width / data-pswp-height by the ATagParams user function.
  • Content layer — link type "Layer" in the RTE and link wizard. A link pointing at a content element (#c123) renders its HTML inside the layer, a link pointing at a page opens it in an iframe.
  • Lazy loading with base64 preview — the imagelazy64 checkbox on a content element renders a tiny base64 placeholder first and loads the real image afterwards.

Compatibility

Extension TYPO3
3.x 14.3 LTS
2.0.0 – 2.0.10 12.4 / 13.4
2.0.11 – 2.0.15 14.1 (pre-LTS)

Installation

composer require tei/photoswipe

Afterwards add the site set PhotoSwipe (tei/photoswipe) to your site — in the backend under Site Management → Sites → Sets, or in config/sites/<site>/config.yaml:

dependencies:
  - tei/photoswipe

If your sitepackage provides a set of its own, add tei/photoswipe to its dependencies instead.

Sites still using sys_template records: since 3.1.0 the static template is no longer registered. Import the TypoScript directly and set the lightbox flag yourself:

# constants
@import 'EXT:photoswipe/Configuration/TypoScript/constants.typoscript'
styles.content.textmedia.linkWrap.lightboxEnabled = 1

# setup
@import 'EXT:photoswipe/Configuration/TypoScript/setup.typoscript'

Tests

composer install
Build/runFunctionalTests.sh

The suite needs a reachable database and a user allowed to create databases; it creates its own <name>_ft<id> schemas per run (drop them afterwards if the database is shared). With Xdebug enabled the bootstrap exceeds PHP's default 128 MB — run with XDEBUG_MODE=off or php -d memory_limit=1G .Build/bin/phpunit -c Build/FunctionalTests.xml. Credentials come from the typo3Database* environment variables, see Build/runFunctionalTests.sh.

The tests are deliberately regression focused — they cover the mistakes that broke this extension on TYPO3 14:

  • services that must be public so makeInstance() resolves them through the container,
  • the link builder overriding buildLink() instead of the removed build(),
  • the lazy64 argument being cast before comparison, and the TCA items format,
  • the alt attribute being set from the argument (Fluid 5, see 3.1.0).

What changed in 3.1.0

Site set

  • New site set tei/photoswipe (Configuration/Sets/PhotoSwipe/), depending on typo3/fluid-styled-content. Use it instead of the static template, see Installation.
  • styles.content.textmedia.linkWrap.lightboxEnabled is set through the set's settings.yaml now — it is a setting of typo3/fluid-styled-content, and site settings take precedence over constants. It is no longer part of Configuration/TypoScript/constants.typoscript.
  • Breaking for sys_template setups: the static template "PhotoSwipe" is no longer registered (Configuration/TCA/Overrides/sys_template.php removed). Existing includes of EXT:photoswipe/Configuration/TypoScript keep working, but the lightbox flag has to be set as a constant — see Installation.

Content layer

  • Long content inside an HTML layer can be scrolled again (touch, pointer and mouse wheel). PhotoSwipe turned these events into swipe gestures and suppressed the wheel event; the layer wrapper now handles them itself when its content overflows.

Packaging

  • Removed a generated dependency injection cache file (var/cache/…) that was accidentally part of 3.0.0; var/ is ignored now.

MediaViewHelper / ImageViewHelper

  • Bugfix: rendered images lost their alt attribute. Since Fluid 5 alt is a registered argument and is no longer copied to the tag automatically; both view helpers only set it when the argument was empty, so the alt text passed by the Media partial ({file.alternative}) was dropped. The attribute is now always set: the argument first, the file metadata as fallback. Guarded by Tests/Functional/AltAttributeTest.php.

What changed in 3.0.0 (TYPO3 14)

The extension no longer worked under v14 — in parts it returned HTTP 500 on every page. The following was adjusted:

PhotoSwipeLinkBuilder

  • build() → buildLink(). Since TYPO3 14 the LinkFactory only calls buildLink() on builders implementing TypolinkBuilderInterface. The old method was never invoked again, which silently dropped all data-pswp-* attributes.
  • $GLOBALS['TSFE']->cObj → $request->getAttribute('currentContentObject'). $GLOBALS['TSFE'] no longer exists in v14.
  • Falls back to a plain link instead of throwing in the middle of the page rendering when no ContentObjectRenderer or no content is available.

Configuration/Services.yaml

  • PhotoSwipeLinkBuilder and ImageService64 are public: true now. TYPO3 instantiates registered typolinkBuilder classes through GeneralUtility::makeInstance() without arguments; only a public service is resolved through the DI container. Without this: ArgumentCountError: Too few arguments to PageLinkBuilder::__construct(), 0 passed, 14 expected on every page.

ImageService64

  • FrontendConfigurationManager::getTypoScriptSetup() requires the request since TYPO3 13.
  • Dependencies are injected through the constructor instead of makeInstance() calls inside the methods.
  • Falls back to defaults when no frontend TypoScript is available, e.g. in the backend.
  • The temporary file used for stripping EXIF data now lives in var/transient/ instead of fileadmin/_processed_/ and is unique per process — previously concurrent requests could overwrite each other's temporary file.

MediaViewHelper / ImageViewHelper

  • class and title are no longer registered arguments in Fluid 5. Both values are now read from the tag builder instead of $this->arguments.
  • Bugfix: MediaViewHelper compared $this->arguments['lazy64'] === 1 strictly against an integer while Fluid passes the string "1". Base64 lazy loading never worked there.

LinkEventListener

  • Icon::SIZE_SMALL → IconSize::SMALL (enum since TYPO3 14).

TCA imagelazy64

  • items converted to associative keys (label / value).

Misc

  • Removed ext_emconf.php — deprecated in TYPO3 14.3, the metadata lives in composer.json.
  • Minimum requirement is PHP 8.2.