Dec 112018

The last few days have been interesting. Ever since WP 5.0 has released, I have watched, bemusedly, as the ratings for Gutenberg plummeted at unimaginable speeds – before the release of WP 5.0 the plugin had around 960 single-star ratings, but once the new version landed, this number shot up to 1120+. It managed twice as many single-star ratings in 5 days as Photonic has managed total ratings in its lifetime! Obviously people have not taken kindly to a radical new paradigm being shoved down their throats. And while “radical new paradigm” sounds cool, “shoving down their throats” isn’t. Has WP missed the oldest trick in the change management playbook? Only time will tell.

In more mundane news version 2.13 of Photonic is now out:

  1. Bug Fixes
    1. In my last post I had joked about Photonic supporting 13 lightboxes, and how the number 13 might be handled superstitiously by people. As it turns out, the thirteenth addition did break something in Photonic. Fancybox3, PrettyPhoto and StripJS lightboxes were broken for gallery transitions (only one photo would show) because I had to change something fundamentally for Magnific Popup, the thirteenth lightbox.
    2. In the interactive workflow for creating native WP galleries, if a “tile size” was being passed, it was being read as a “thumb size”. This behaviour has been fixed.
  2. New Additions
    1. I have added multiple new options to the lightbox settings screen
    2. I have added an explicit check within the interactive flow to ensure that the calling user has the capability to edit posts
Dec 062018

If you haven’t heard, WP 5.0 featuring Gutenberg is here. If you haven’t had a chance to form your opinion about it, do ensure that you download a copy of the “Classic Editor” plugin to recover from any shock caused by Gutenberg. Displaying behaviour that has been symptomatic of Gutenberg all along, I will move my sites to WP 5.0, but I will keep my wife on 4.9.8 before things stabilize. I will additionally install Classic Editor because the new WP 5.0 text editor is just too crippled, and Gutenberg suffers from an exceptional amount of bloat.

Having said the above, here is Photonic version 2.12 to go with WordPress 5.0.

  1. Magnific Popup Support:
    People are usually concerned when they have 13 of something. Well, for those superstitiously minded folks, here is cause for concern: Photonic has added support for its thirteenth lightbox – Magnific Popup. Unlike PhotoSwipe (which is also from the same developer), Magnific was a lot easier to code for, and was reminiscent of some of the easier coding I have had to do for Photonic.
  2. New Features / Changes:
    This release features a number of small additions / changes:

    1. I have moved the “Lightboxes” options from under Photonic → Settings → Generic Options to its own header, Photonic → Settings → Lightboxes.
    2. Consequently I have added a lot of customization options to the lightboxes, and I will continue adding more over the next few releases.
    3. I have added the capability to launch a lightbox from a slideshow. Currently this works only if your lightbox is LightGallery or Magnific, but I will be expanding this feature.
    4. There is a new option to remove the photo count from Google Album displays, under Photonic → Settings → Google Photos → Hide Photo Count in Album Title Display.
  3. Bug Fixes:
    1. In some cases slideshows were not stretching to the full width. This should be working now.
    2. There was a bug in the interactive flow that was causing a zero-impact JavaScript error while trying to create a new gallery. This has been patched.

Hope you enjoy the new release.

Nov 262018

I have released version 2.11 of Photonic with the following changes:

  1. JavaScript Optimization
    When Photonic started out in September 2011 it only had support for two lightboxes – Colorbox and Fancybox. About a month later I added support for PrettyPhoto, and then for a long period of time I didn’t add anything else. About 4 years later I added support for Swipebox, and I haven’t looked back since then, adding multiple lightboxes and amping up the capabilities of each script. During this process though, the core JavaScript file for the plugin kept getting bigger and bigger. Finally when I added support for PhotoSwipe last month I realized how big the JavaScript had become, and at that point I had to take stock and do some rewriting.

    So, in this version I broke down the core JavaScript and primarily separated each lightbox script into its own file. The net result was a reduction in size of almost 45%!

  2. Bug Fixes
    1. In the previous release I had made a change to have Flickr calls within a collection be executed in parallel. This had a side-effect: the sort order of albums in a collection stopped being respected. This should be fine now.
    2. There was an undetected bug since a long time: Instagram image sizes were being hardcoded, resulting in weird displays. This has been addressed.
    3. The interactive gallery creation flow had a bug that was causing it to crash for PHP versions < 5.5. This too should be fixed now.
  3. A small change I have made is to make the “display link” for Flickr be a little more “specific”. E.g. If a photo is in an album its link in Flickr will be specific to that album instead of the user’s photostream

Hope you enjoy this release. As always, if you are enjoying the use of Photonic please leave me a good word as a plugin review.

Nov 112018

WordPress 5.0 is on the horizon, and nothing in WP history has faced as much backlash as the inclusion of Gutenberg in WP 5.0 core. While the powers that be in the core development team portray Gutenberg as the light at the end of the tunnel, an overwhelming number of developers and users are of the opinion that the light is that of an oncoming freight train rather than one of hope.

I have written about my initial impressions about Gutenberg in the past and I will not endeavour to do so again. I do want to voice my disappointment with the poor quality of support and documentation around Gutenberg, though. On the one hand WP wants everyone to embrace Gutenberg with open arms. And on the other, it has made it extremely difficult for advanced plugins to operate with Gutenberg. Issues and support queries go unanswered for weeks if not months, there are JS errors that pop up in the JS console, and the code doesn’t do what the documentation says it should.

In any case, Gutenberg WP 5.0 is scheduled to be released on 27th November, and if it does, well, that is what this post is about. Version 2.10 of Photonic has just been released and this is what is included:

  1. Gutenberg Support:
    Just in case it wasn’t clear from all that I have written above, this release has Gutenberg support. Do see the documentation before you attempt to use “Convert to blocks” though. Also refer to the dashboard menu item, Photonic → Prepare for Gutenberg.
  2. Shortcode Replacement:
    Gutenberg implementation necessitated that users should be able to change existing Photonic-specific gallery to another shortcode before attempting to “Convert to blocks”. For this purpose there is a shortcode replacement utility bundled under Photonic → Prepare for Gutenberg.
  3. Advanced Settings:
    I have added a new sub-section under Photonic → Settings → Generic Options, called “Advanced”. Under this:

    • I have moved the SSL and performance logging options there.
    • I have added an option to increase the cURL timeout for cases where the connection between a server to the photo provider is slow.
    • I have also added an option to turn on debug tracing. So far this only helps print out the entire response in the interactive workflow.
  4. I have put in some performance optimization to make calls to Flickr collections in parallel. This helps reduce the time taken to fetch a collection.
  5. Bug Fixes:
    The following bugs have been fixed:

    • The default album search by user was failing for SmugMug galleries. This should be alright now.
    • I have also fixed an issue where the layout='strip-above' setting was not working for the slideshow layouts.

Hope you enjoy this release of Photonic!

Oct 092018

I had to release a quick patch for a minor z-index issue affecting Photonic. The symptoms would only be seen if one were to use the Interactive Workflow for inserting a gallery, where the gallery would suddenly disappear under a translucent overlay. There is no impact to the rest of the plugin due to this fix.

I have also been implementing Gutenberg support under the hood. While the implementation doesn’t seem very difficult so far, the learning curve is exceptionally steep, particularly if one wants to avoid going into ReactJS to build / transpile packages. This is causing a fair bit of trial and error and no small amount of frustration, but I am hopeful of getting this done well in time for the official release of Gutenberg.

Oct 082018

I have released version 2.01 of Photonic a few minutes back. Thankfully my tests for version 2.00 paid off and I didn’t receive any overwhelming bug reports. Correspondingly these are the changes for this release:

  1. PhotoSwipe
    Photonic now has support for its twelfth lightbox – PhotoSwipe. This was a long-pending request which I finally was able to support. PhotoSwipe is rated very highly among developers for being light, modular etc. However my thoughts are different – PhotoSwipe is built to be used without JQuery, and as a result its core size is quite big (41KB of JS). This would be fine if sites didn’t use JQuery, but most WP themes and plugins use it. As a result there is no bandwidth saved by the script for more than 90% of the cases, instead the script ends up being larger than it should have been. Consequently, a lot of things like the lightbox markup are not included in the script and have to be handled by developers implementing the script.

    In any case, despite its quirks almost everything has been supported in Photonic using PhotoSwipe, except for Flickr videos.

  2. Instagram had changed (again) how high-resolution images can be accessed, so I had to tweak the code for the same. Consequently I have removed the explicitly defined sizes for HD images and replaced it with an option, “Largest”. This will automatically pull the image with the highest resolution.
  3. In 2.00 I had added a feature to allow searching for images in SmugMug. Unfortunately this ended up not respecting the album’s native sort order. I have fixed this issue.

Do let me know of your feedback regarding the Interactive Workflow – I would love to hear your thoughts! As always, if you like Photonic and the support you receive, a good review is greatly appreciated!

Sep 302018

After a few weeks of intense development and testing (which always gets exponentially harder when I have to travel internationally for work), version 2.00 of Photonic is now finally available for use. As alluded to earlier this is a massive release. The following are what’s new in this release:

  1. New Interactive Workflow
    This is by far the biggest piece of development I have done for Photonic since the original release – almost 5000 lines PHP, JS and CSS code! On the surface this does a very simple thing: it creates a new button in the editor:
    Add / Edit Photonic Gallery

    Add / Edit Photonic Gallery

    Clicking on the button is what triggers the magic. Unlike the traditional way of fumbling through the helpers to find album ids and folder ids, the workflow does all the heavy lifting for you.

    The traditional way of adding a gallery via “Add Media → Photonic” still exists. The “new way” has multiple advantages in addition to the obvious. For one, even if you are not in the visual editor, you can select the text for the shortcode in the text editor and click on the “Add / Edit Photonic Gallery” button to get the interactive workflow.

  2. Default Users
    As a part of the interactive workflow, one crucial feature provided is that of a “Default user”. This is a feature that has been requested every now and then over the years, and I finally got around to adding it this time. Simply put, if you set up a default user you don’t need to explicitly supply one in a shortcode. This feature is available for Flickr, SmugMug, Picasa and Zenfolio. Google Photos and Instagram don’t need this as they need back-end authentication, so the authenticated user is the default user.

    As a happy corollary of the above, for Instagram you now don’t need to hunt down your user id – the authenticated user’s photos are displayed by default.

  3. Zenfolio Enhancements
    Zenfolio, while having a comprehensive API, has been lacking in several areas. E.g. there is no way to combine a user and a search term in a single API call, which results in there being no easy way to show all photos for a user. There are several other such shortcomings, but in this release I have managed to bridge the gap with respect to several such challenges in addition to providing new features:

    1. Zenfolio recently made the move from HTTP to HTTPS. Photonic has been modified to reflect that.
    2. Zenfolio authentication is now supported. Note that unlike other providers, Zenfolio has a custom authentication process (not OAuth1 or OAuth2). This causes a different looking authentication flow, where, unlike other providers you have to enter your Zenfolio password here. Note that Photonic does not store this password anywhere!
    3. You can now search for photosets for a user using specific text terms or categories. Previously this feature was not user-specific. Note, however, that Photonic has to make multiple API calls to support this, and there might be a performance hit based on how many photosets you have. See the examples in the demo page.
    4. You can also use the photoset_type filter (i.e. Gallery or Collection) for user-specific photosets. See the examples in the demo page.
    5. The kind attribute (i.e. Recent or Popular) now works for user-specific photosets.
    6. The filter attribute is now supported for Zenfolio for filtering photosets by id.
  4. Other Additions / Changes
    1. You can now display photos at a user level and at a folder level for SmugMug galleries. This was earlier only possible at an album level. You can also filter the photos by text or keywords. See the examples here.
    2. I have added the capability to track performance for each gallery (Photonic → Settings → Generic Options → Generic Settings → Performance logging). This is turned off by default to reduce the output added to your page markup. However, please feel free to turn it on to see why a gallery is loading slowly.
    3. For native WordPress galleries you can now set a tile_size in the “Justified Grid” and “Mosaic” layouts.
    4. The download URL for Flickr has been modified to reflect the original image.
    5. You can now disable the visual editor by individual post types. This is useful if you are facing conflicts with some plugins, but not other plugins. This is available under Photonic → Settings → Generic Options → Generic Settings → Disable Visual Editing for specific post types. The thermonuclear option to disable the visual editing capabilities completely still exists (Photonic → Settings → Generic Options → Generic Settings → Disable shortcode editing in Visual Editor)
    6. If a native WP gallery is using additional plugins to add videos to the output (e.g. Media Library Assistant), Photonic can now display the video in a lightbox as a part of the gallery.
    7. I have removed the JQuery Masonry script bundled with Photonic and switched to the one that comes out of the box with WordPress. Note that this is only used for old versions of IE.
  5. Bug Fixes
    1. There was a “short-term cache” bug for Google authentication, which caused a user to see the previous user’s photos for the first 30 minutes after the authenticating user was changed. This should work fine now.
    2. There was an issue where, in the “Random Justified Gallery” layout, there was a visible “pop and realign” happening whenever the “Load More” button was being clicked. This has now been addressed.
    3. Google Photos’ API change that was causing errors while fetching albums due to a reduction of the maximum number of photos that can be pulled has been taken care of.

Gutenberg is not yet supported for now, but very soon it will be. The interactive workflow takes me most of the way for Gutenberg integration.

Aug 302018

Google made an unannounced change to its Photos API on 29th or 30th August, wherein it changed the maximum number of photos returned in a single call to 100 from 500.

Unfortunately this is a breaking change – if you pass a number > 100 the API returns an error … and this affects Photonic. Photonic by default displays the maximum permissible number of photos or albums to minimize API calls, so if you don’t pass a count or photo_count parameter to the shortcode, it will default the value to 500. As a result of this a shortcode that was working until yesterday might now not work. To remedy this you have two options:

  1. Go to the file wp-content/plugins/photonic/extensions/Photonic_Google_Photos_Processor.php, line 52. You will see this:
    'count' => 500,

    Change it to this:

    'count' => 100,

    Save the file, and all your shortcodes will be fine now.

  2. If you are uncomfortable making the code change above you can explicitly define the count=100 attribute on shortcodes for Google Photos. This will take a bit more effort on your part, but will be just as effective

Why am I not releasing this fix myself? I am about 75% done with the big changes that I had talked about last week, so I don’t want to release the above as a patch and disrupt something else unwittingly. It has been included with the next version of the plugin though.

Aug 262018

I love Google and I have several very close friends working for them. But there is one aspect of Google that is irritating: they phase out things without putting an effective transition plan in place, and often without offering any replacement. They did this with Reader (I haven’t forgiven them for it), they did this with Picasa (though they did replace Picasa’s web-version with Google Photos in a painful process), and FeedBurner, if people are to be believed, is surely on the chopping block.

Remember Feedburner? If you don’t, I don’t blame you. The service was a rage in the previous decade, but Google has let it slide into a slow and painful obscurity. Probably the only reason Google still has it alive is that this is a customer-to-customer service that they cannot terminate (as opposed to Reader or Picasa, which were Google-to-Customer). In any case, bugs in FeedBurner have not been fixed since 2012, and no new features have been added since 2010.

As it happens though, this site has used FeedBurner for a while now. But wary of being left out to dry I took the plunge and moved to MailChimp. If you are an “Active” subscriber to this site I have migrated you over to the new email-subscription service. You should almost certainly be receiving this post via MailChimp on 27th August. I have deactivated the FeedBurner link, but if you still receive a second email from the old service, please let me know and I will look into it.

Aug 232018

One of the only criticisms against Photonic is that it is hard to use, with users being required to look at multiple places to construct a shortcode. The criticism is justified, because building a “flow” for inserting a shortcode wasn’t on my agenda when I started out with the plugin.

But Photonic is now going to finish the eighth year of its existence and the plugin has evolved from its humble beginnings to something truly complex and extremely versatile. The thorough but wordy “Media Insertion Screen” does have its limitations both in terms of development as well as usage, and in spite of having a set of “Helpers” the UX is not particularly optimal. I have received direct requests / feedback via the support forum to at least support some sort of a “default user” feature if nothing else, and while I have always been saying that something is in the works, there was no way for me to demonstrate this.

And now, unless some higher priority ad hoc development comes up I am happy to announce that the next release of Photonic will feature a much more friendly way to generate the shortcodes.

To start off, you are presented with a popup that asks you to select the source of your gallery:

Pick your source

Step 1: Pick your source

The first screen is pretty much like the type='...' attribute of the shortcode, i.e. it is the main switch. The fun begins after this. Once you select your source you are presented a context-sensitive set of options:

Pick the Gallery Type

Step 2: Pick the Gallery Type

Above you see the options for SmugMug, but the list changes based on the source. E.g. for Flickr you can pick a collection, for Zenfolio you can show a group hierarchy etc. The cool thing now is that rather than describing via words what combinations of view='...' can be used with what, you now have a predefined list from a dropdown.

Once you make your choice you are presented with a graphical interface showing the result of your selections:

Step 3: Make your choices

As you can see, there is no more hunting around for an album in the Helpers section. Everything is presented to you here directly and visually. Again, the output is contextual. Let’s say in the previous screen you had picked “Multiple Albums”. Then, in this screen you would be able to select multiple albums instead of a single one.

After this screen you are taken to the options for layout, specifying counts etc. and the shortcode is generated accordingly.

A Good News / Bad News Situation

Obviously the changes I am making will greatly enhance usability, which is good news. Also, for people happy with the older interface I will be keeping that around; I have no desire for Photonic to end up like Gutenberg 🙂

The bad news is that though I have already written 3700+ lines of code for this, I still have considerable ground to cover. The key remaining pieces are:

  • The entire Instagram module
  • Most of the native WordPress module
  • Populating each field individually from a shortcode already in the post (i.e. deconstructing the shortcode)
  • Most of the integration with TinyMCE

If I were to assign a percentage of completion I would say I am 60% there, but the amount of testing this sort of a feature demands is insane. Hopefully the final product will be worth the wait!

What makes things tougher is that as I keep developing this, I keep realizing some missing functionality that can be added to the plugin. E.g. in Step 3 above I let you search for photos on SmugMug—this is a brand new feature as are several others such as filters for Zenfolio.

And with Gutenberg hanging upon my head like the sword of Damocles I am approaching the crossroads where I have to decide whether to bundle Gutenberg support in this iteration of the plugin or the next.

Do let me know what you think! I would love to get your inputs.