Jump to content



Recommended Posts


A module which helps including Photoswipe and brings some modules for rendering gallery markup. Feedback highly appreciated :)

(Also pull requests are appreciated ? - have a new Job now and don't work a lot with ProcessWire anymore, yet, feel free to contact me here or on GitHub, Im'm still "online"!)


Modules directory: http://modules.processwire.com/modules/markup-processwire-photoswipe

.zip download: https://github.com/blynx/MarkupProcesswirePhotoswipe/archive/master.zip

You can add a photoswipe enabled thumbnail gallery / lightbox to your site like this. Just pass an image field to the renderGallery method:

$pwpswp = $modules->get('Pwpswp');
echo $pwpswp->renderGallery($page->nicePictures);

Options are provided like so:

$galleryOptions = [
    'imageResizerOptions' => [
        'size' => '500x500'
        'quality' => 70,
        'upscaling' => false,
        'cropping' => false
    'loresResizerOptions' => [
        'size' => '500x500'
        'quality' => 20,
        'upscaling' => false,
        'cropping' => false
    'pswpOptions' => (object) [
        'shareEl' => false,
        'indexIndicatorSep' => ' von ',
        'closeOnScroll' => false

echo $pswp->renderGallery($page->images, $galleryOptions);

More info about all that is in the readme: https://github.com/blynx/MarkupProcesswirePhotoswipe

What do you think? Any ideas, bugs, critique, requests?


  • Like 19
  • Thanks 1
Link to comment
Share on other sites

Hey Blynx,

Thanks for the nice module :)

Not sure, it's probably just me, but to get this working (local MAMP setup) I had to use the full module class name (MarkupProcesswirePhotoswipe) (not the alias Pwpswp) and the css/javascript etc paths were incorrect , so instead of MarkupPwpswp/path-to-files within the .module file, I had to change these to MarkupProcesswirePhotoswipe/path-to-files 

After this all worked nicely :) 

Thanks again!

  • Like 3
Link to comment
Share on other sites

Update is out: https://github.com/blynx/MarkupProcesswirePhotoswipe

Also removed the Pwpswp class alias, because it was pretty pointless. Processwire does not recognise it as a module and I don't really use static methods in that class.

0.5.1 - 2017/07/06, fixes

removed: Removed pointless shortcut alias class  
fixed: Use of correct module/class name for file paths  
fixed: Configuration instructions for file paths  
other: Updated readme  

  • Like 5
Link to comment
Share on other sites

Yay, update: https://github.com/blynx/MarkupProcesswirePhotoswipe

Now has some simple 'themes', cooler ones later ...

$pwpswp = $modules->get('MarkupProcesswirePhotoswipe');
echo $pwpswp->renderGallery($page->nicePictures, ['theme' => 'h-scroller']);

// available themes: plain, flex, h-scroller

0.7 - 2017/07/11, themes

fixed: Size option correctly adopts height value
added: Theme functionality
added: Simple themes 'plain' (previous default), 'flex', 'h-scroller'
other: Updated readme
other: No notice on undefined photoswipe options
other: Refactoring

  • Like 5
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hey @blynx,

It is voluntary to make this module only compatible with PHP 7 ?


I wanted to give a try to your module for a website I am building right now - using PHP 5.6 - but calling the module with :

$pwpswp = $modules->get('MarkupProcesswirePhotoswipe');
$gallery = $pwpswp->renderGallery($page->gallery, ['theme' => 'masonry']);

give me the following error (due to scalar type arguments) :



Anyway, already loving it, thanks for making this module. I am using it with InstagramFeed, IsotopeJS and InfiniteScroll in a custom theme - Masonry - based on the Plain one :




  • Like 2
Link to comment
Share on other sites

  • 1 month later...


so there is the new version out now which includes a gallery type like the ones in the medium articles.

The whole module has been rewritten and I changed the way the galleries are rendered. Instead of weird template files the galleries are now modules which extend the MarkupPwpswpGallery module. Have a look at the readme for some more info.

Everything should work just fine when updating despite the code changes. I build a gallery module which should ensure compatibility in case anyone was using her/his own template file.

This is the new gallery type „Petersburger Hängung



The inspiration for that type: https://github.com/SiteMarina/guggenheim

The linear partition problem:
https://github.com/crispymtn/linear-partition/blob/master/linear_partition.coffee#L11 (coffee script)

Yet, I implemented a simplier and I guess faster algorithm: https://stackoverflow.com/a/6670011/3004669
Maybe I will implement the original algorithm, too, at some point. ... 


  • Like 8
Link to comment
Share on other sites


This is weird - but it looks like a permissions problem on your side? I guess you can fix this by setting the file/folder permissions.
I couldn't find anything wrong here at my place - is the folder name of the module correct?

How did you install it?

Sorry for the trouble - will have a closer look later the week

Maybe try a fresh installation of the module for now -

Link to comment
Share on other sites

  • 5 months later...


Mh can't really tell from that screenshot.
One thing I noticed by myself already is, that it doesn't seem to work when caching is turned on - but I can't find the time to work on it right now. : |

Can you have a look into the markup and see what actually was appended, also which actual paths/urls are used which are failing here?


Link to comment
Share on other sites

  • 3 months later...

I have used your great module on my PHP 5.6 installations.  I am working on a new website and would like to use this module.

I am getting the following error on installation:


Any help you can provide with how to get this installed would be greatly appreciated.

By the way, I am getting a similar error when trying to upgrade from your version 7.2 to 9.2.2 (whether using PHP 5.6.x, PHP 7.0.x or PHP 7.2.x)

PHP 5.6.x 


PHP 7.0.x


PHP 7.2.x



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...