tei / photoswipe
TYPO3 PhotoSwipe-Plugin for native image-enlargement
Package info
github.com/j0nnybrav079/photoswipe
Language:JavaScript
Type:typo3-cms-extension
pkg:composer/tei/photoswipe
Requires
- php: ^8.2 || ^8.3 || ^8.4 || ^8.5
- typo3/cms-backend: ^14.3
- typo3/cms-core: ^14.3
- typo3/cms-frontend: ^14.3
Requires (Dev)
- typo3/testing-framework: ^9.6
Suggests
None
Provides
None
Conflicts
None
Replaces
- typo3-ter/photoswipe: 3.1.0
This package is auto-updated.
Last update: 2026-10-25 18:51:15 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-heightby theATagParamsuser 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
imagelazy64checkbox 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
publicsomakeInstance()resolves them through the container, - the link builder overriding
buildLink()instead of the removedbuild(), - the
lazy64argument being cast before comparison, and the TCAitemsformat, - the
altattribute 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 ontypo3/fluid-styled-content. Use it instead of the static template, see Installation. styles.content.textmedia.linkWrap.lightboxEnabledis set through the set'ssettings.yamlnow — it is a setting oftypo3/fluid-styled-content, and site settings take precedence over constants. It is no longer part ofConfiguration/TypoScript/constants.typoscript.- Breaking for
sys_templatesetups: the static template "PhotoSwipe" is no longer registered (Configuration/TCA/Overrides/sys_template.phpremoved). Existing includes ofEXT:photoswipe/Configuration/TypoScriptkeep 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
altattribute. Since Fluid 5altis 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 byTests/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 theLinkFactoryonly callsbuildLink()on builders implementingTypolinkBuilderInterface. The old method was never invoked again, which silently dropped alldata-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
PhotoSwipeLinkBuilderandImageService64arepublic: truenow. TYPO3 instantiates registeredtypolinkBuilderclasses throughGeneralUtility::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 expectedon 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 offileadmin/_processed_/and is unique per process — previously concurrent requests could overwrite each other's temporary file.
MediaViewHelper / ImageViewHelper
classandtitleare no longer registered arguments in Fluid 5. Both values are now read from the tag builder instead of$this->arguments.- Bugfix:
MediaViewHelpercompared$this->arguments['lazy64'] === 1strictly 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
itemsconverted to associative keys (label/value).
Misc
- Removed
ext_emconf.php— deprecated in TYPO3 14.3, the metadata lives incomposer.json. - Minimum requirement is PHP 8.2.