Jump to content

MarkupProcesswirePhotoswipe


blynx

Recommended Posts

Hej,

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"!)

petersburger.gif.b4f2866466f2d40855977717dd78f484.gif

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:

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

Options are provided like so:

<?php
$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?

cheers
Steffen

  • 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 ...

<?php
$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) :

errphotoswipe.thumb.png.7cd1f87083994cc25ed28abd0d4207ba.png

 

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 :

 

MarkupProcesswirePhotoswipe.thumb.gif.dedb2554421ab1df139ef3ef8d5cc1e2.gif

 

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

Ok,

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

petersburger.gif.b4f2866466f2d40855977717dd78f484.gif

 

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

The linear partition problem:
http://www8.cs.umu.se/kurser/TDBAfl/VT06/algorithms/BOOK/BOOK2/NODE45.HTM
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

Hm!

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...

Hi!

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?

cheers!

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:

photoswipe1.thumb.png.35e2fae81dca5a28e6ec50a3e8ab9e00.png

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 

photoswipe-pw1.thumb.png.74414ca9482916481ac3abf1a4155deb.png

PHP 7.0.x

photoswipe-pw2.thumb.png.605f1ac6b7de7122348d69ac15186398.png

PHP 7.2.x

photoswipe-pw3.thumb.png.716eb360dcd4b3425b95373daefd6088.png

 

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...