blynx

MarkupProcesswirePhotoswipe

Recommended Posts

Hej,

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

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 18

Share this post


Link to post
Share on other sites

This is cool! Thanks a lot. In the near future, I want to port some WP sites with galleries to ProcessWire, so I will definitely give it a try. I put it on my loooooooong todo list :) 

Share this post


Link to post
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 2

Share this post


Link to post
Share on other sites

Ah! yep, I renamed the module later on - thats a bug I will correct later. Thanks!

  • Like 1

Share this post


Link to post
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 4

Share this post


Link to post
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 4

Share this post


Link to post
Share on other sites

A great module!  I needed a photo gallery for a few websites and this works fantastic.  Please go ahead and get this module published in the ProcessWire Module Directory.

  • Like 1

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Nice, glad you like it!

I will consider this and probably change that - thanks for the feedback!

  • Like 2

Share this post


Link to post
Share on other sites

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 7

Share this post


Link to post
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


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Macrura
      Field Descriptions Extended
      This module enables you to extend field descriptions by dividing short descriptions with a longer text that is revealed in a toggle.
      Github: https://github.com/outflux3/FieldDescriptionsExtended
      Extending your field descriptions using the standard field's description field.
      Once this module is installed, it will automatically search your description field for the presence of 5 dashes (-----).
      Any content above the 5 dashes will be visible and the content below the dashes will be hidden. A 'More...' link will appear at the end of the short description which when clicked will reveal the rest of the description.
      Using Simple Markdown Editor with the description field
      If you have Simple Markdown Editor (InputfieldSimpleMDE) installed, you can enable the field description to have that editor.
      *When using Simple MDE, you can use the button (Insert Horizontal Line) instead of typing 5 dashes. More about SimpleMDE.
      Extending your field descriptions using content from a ProcessWire Page for the field description.
      You may use the content from a ProcessWire page as a field description. This would allow you to easily insert images, links, and use hanna codes.
      To use page content for your field descriptions, please follow these instructions:
      Install Select Fields module (FieldtypeFields) http://modules.processwire.com/modules/fieldtype-fields/ Create a new field using this field type, e.g. field_select. Add the field to any template you will be using for your field descriptions. Setup your help pages (for example under a settings branch) where you will store the field description content,using the template containing the Field Select. Add content to a page and select the field where that content should show. To show a short text before the link to the longer content, separate them with 5 dashes Be sure to update your settings on this page, first enable page content descriptions,then specify the name of the Select Fields field, template to search, and content field. If you create a field description using this method, please note that the description field must be blank for contexts where you want the page content to appear.
      You can freely use template context for field descriptions, but the Page Content method is not context sensitive and will display under all contexts where the description is blank.
      ----
      original post:
      This is a new module, hope to release soon, which allows extended field descriptions, in currently 2 ways.
      The main feature of the module is that you can have a short description and then a 'more...' link which drops down a longer block of text.
      This is achieved by separating the intro/visible text and the rest with 5 dashes.

      Example setup:

      the 2nd way is if you are using AdminThemeUiKit, you can show extended field instructions in a panel. The content of the panel is edited on a regular PW page. This use case would probably not be that common, but if you had a field that required some extended instructions for how to use, this could be useful; Also, since this allows you to target information and instructions down at the field level, it could reduce the amount of documentation needed on a global level, since it is a lot more context targeted.

    • By netcarver
      Part 1 of a 2 part Module & Service Reveal.
      I'm currently working on a new module: ModuleReleaseNotes that was inspired by the work I originally did on making Ryan's ProcessWireUpgrades module "release" aware. In the end, I decided to ditch the approach I was originally taking and instead work on a module that hooked in to the UpgradeConfirmation dialog and the module edit page.
      Aims
      My aims for this module are as follows...
      Make discovery of a module's changes prior to an upgrade a trivial task. Make breaking changes very obvious. Make reading of a module's support documentation post-install a trivial task. Make module authors start to think about how they can improve the change discovery process for their modules. Make sure the display of information from the module support files/commit messages doesn't introduce a vulnerability. Looking at these in turn...
      Making discovery of a module's changes prior to upgrade a trivial task.
      This is done by adding a "What's changed section" to the upgrade confirmation dialog.  This section takes a best-effort approach to showing what's changed between the installed version and the updated version that's available via the module repository.
      At present, it is only able to talk to github-hosted repositories in order to ask them for the release notes, the changelog file (if present) and a list of commits between the git tag that matches the installed version and the tag matching the latest version.
      It will display the Release Notes (if the author is using the feature), else it will display the commits between the tags (if tagging is used by the module author) else it will show the changelog file (if present) else it will show the latest N commits on the master branch (N, of course, being configurable to your liking.)
      An example of the Github Release Notes pulled in for you, taken from Mike Rockett's TextformatterTypographer Module...

      An example of a tag-to-tag commit list from the same module...

      An example of a changelog - formatted to show just the changes (formatting styles will change)...

      Finally, an example of a fallback list of commits - sorry Adrian ...

       
      Making breaking changes obvious.
      This is currently done by searching for a set of configurable search strings. Later versions may be able to support breaking change detection via use of Semantic Versioning - but this may require some way of signalling the use of this versioning standard on a module-by-module basis.
      For now, then, you can customise the default set of change markers. Here I have added my own alias to the list of breaking change markers and the changes section of the changelog is styled accordingly (these will be improved)...

       
      Make reading of a module's support documentation, post-install, a trivial task.
      This is done by making some of the support files (like the README, CHANGELOG and LICENSE files) readable from the module's information/settings screen. There is an option to control the initial open/closed state of this section...

      Here is Tracy's README file from within the module settings page... 

       
      Make module authors start to think about how they can improve the change discovery process for their modules.
      There are notes in each of the sections displayed on the upgrade confirmation page that help authors use each of the features...

       
      Make sure display of external information doesn't introduce a vulnerability.
      This is an ongoing concern, and is the thing that is most likely to delay or prevent this module's release lead to this module's withdrawl should a vulnerability be found. Currently, output is formatted either via Markdown + HTML Purifier (if it was originally a Markdown file) or via htmlspecialchars() if it has come from a plaintext file.
      If you discover a vulnerability, please get in contact with me via the forum PM system.
       
      Ongoing...
      For now, I've concentrated on integration with GitHub, as most people use that platform to host their code. I know a few people are hosting their repositories with BitBucket (PWFoo comes to mind) and some with GitLab (Mike Rockett?) and I would eventually like to have adaptor implementations for these providers (and perhaps GitKraken) - but for now, GitHub rules and the other hosts are unsupported.
       
      Links
      Github: ModuleReleaseNotes
      PW Module Repository: Here (pending?)
    • By mtwebit
      Tasker is a module to handle and execute long-running jobs in Processwire. It provides a simple API  to create tasks (stored as PW pages), to set and query their state (Active, Waiting, Suspended etc.), and to execute them via Cron, LazyCron or HTTP calls.
      Creating a task
      $task = wire('modules')->Tasker->createTask($class, $method, $page, 'Task title', $arguments); where $class and $method specify the function that performs the job, $page is the task's parent page and $arguments provide optional configuration for the task.
      Executing a task
      You need to activate a task first
      wire('modules')->Tasker->activateTask($task); then Tasker will automatically execute it using one of its schedulers: Unix cron, LazyCron or TaskerAdmin's REST API + JS client.
      Getting the job done
      Your method that performs the task looks like
      public function longTask($page, &$taskData, $params) { ... } where $taskData is a persistent storage and $params are run-time options for the task.
      Monitoring progress, management
      The TaskerAdmin module provides a Javascript-based front-end to list tasks, to change their state and to monitor their progress (using a JQuery progressbar and a debug log area). It also allows the on-line execution of tasks using periodic HTTP calls performed by Javascript.

       
      Monitoring task progress (and log messages if debug mode is active)

       
      Task data and log

      Detailed info (setup, task dependencies, time limits, REST API etc.) and examples can be found on GitHub.
      This is my first public PW module. I'm sure it needs improvement
       
    • By netcarver
      A very simple textformatter that was inspired by Diogo's RemoveHeight textformatter.
      This one strips the height from any images and either adds a custom class or adds a max-width:100% as an embedded style.
      Github: https://github.com/netcarver/TextformatterFluidImages
      PW Repo: To Be Confirmed.
    • By jaro
      Hello,
      in one of my current projects, we have a test and production stage with their own ProcessWire installations, and we regularly want to migrate template/field configuration to the next stage without migrating content as well. ProcessWire supports this via the import/export functionality in the admin GUI. However we (and some others) would like to do this as part of an automated process. There seem to have been some discussion on this topic and two existing modules that get pretty near our requirements:
      https://github.com/mindplay-dk/SystemMigrations/blob/master/SystemMigrations.module https://github.com/LostKobrakai/Migrations However, they try to solve more then we need and for mindplay-dk's module, development seems to have discontinued. At that point I decided to build a more simple module with reduced scope that basically just makes ProcessWire's import/export automation-ready.
      Thanks in advance for trying this out and any feedback!
      About this Module
      CAUTION: This module is incompatible with repeater fields and ProFields.
      The module enables you to transfer template and field configuration from one processwire installation to another in an automated way.
      Changes to templates or fields are exported to the file system immediately (so they can be added to source control together with changes in the template files) The import script is designed to run from the command line (so it can be invoked from your build/deployment tool). On invocation in import mode, a DB backup is created template/field changes from the persist directory are imported into the DB In restore mode, the import script can restore any of the DB backups previously saved How to Use
      Make sure the module is installed in the source and destination ProcessWire environments. After installation of the module, you should check if the module's default persistDirectory configuration setting fits your requirements. The module will automatically export all fields, fieldgroups, and templates to JSON files in the directory specified by that setting. Note that the same setting is used by the import script as well, so if you change it, make sure you change it in all affected ProcessWire environments. The JSON files can be transferred to the destination ProcessWire environment. Running the import script from the command line will import template and field data in the destination ProcessWire environment. Manual Installation
      Caution: Beta software - do not use in a production environment without prior testing and regular back-ups.
      Caution: This module is incompatible with repeater fields and ProFields.
      In case automatic installation does not work, get the code at https://github.com/jaromic/pw-autoexport-tf/ and follow the instructions in README.md for manual installation.
      Manual Uninstall
      Delete the following files and directories from your module directory:
      AutoExportTemplatesAndFields/ AutoExportTemplatesAndFields.module  Download Install from the module directory, clone the repository via GitHub, or download ZIP.