Lightbox with PhotoSwipe

In the past I have used the plugin “Responsive Lightbox” for the enlarged display of pictures. Unfortunately, this solution had some weaknesses:

  • No possibility to enlarge the picture view.
  • Swipe gestures are quite “jerky” – you can see how the picture view follows the finger movement very slowly

In particular, I noticed the lack of the possibility of image magnification on another website, where I have seen people who have tried to enlarge individual images with the common two-finger gesture on their smartphones.

As an alternative, I finally discovered PhotoSwipe – a JavaScript library that not only allows you to magnify images with a mouse click or finger gestures, but also provides a full-screen view. Also, the response to input is much snappier as in “Responsive Lightbox”.

Hoever I missed a useful integration to WordPress. For “Responsive Lightbox” there is a paid integration, but this comes with annual fees. Some of the other alternatives were already several years old and have not been updated for a while, which I found a bit strange (as an example see “WP PhotoSwipe” or “Simple PhotoSwipe”). One explanation for this is the note by the Maintainer of PhotoSwipe in Github:

Script is licensed under MIT license with one exception: Do not create a public WordPress plugin based on it, as I will develop it. If you need to use it for a public WordPress plugin right now, please ask me by email first. Thanks!

In fact, this note has been there since the beginning of 2015 – almost three years. However, the general use of PhotoSwipe in WordPress with a self-developed plugin that is not offered for download is possible without any limitation.

Since the existing WordPress plugins were not useful for my purposes – mainly because only pictures in Galleries with PhotoSwipe were displayed, but no single linked images, I finally developed a separate solution. Although I would not have required a formal permission due to the MIT license, I asked maintainer to avoid third parties complaining at WordPress that there is plugin released under alleged infringement of existing licenses.

You can get the result in the WordPress repository:

Lightbox with PhotoSwipe

In the current version, all linked images in a post or a page are displayed with PhotoSwipe, regardless if they are part of a gallery or individual thumbnails with links to the original.

The is no configuration in the backend yet – but this may change in future versions.

Leave a public comment

Your email address will not be published. If you want to contact me personally, see the imprint.