• Hi,
    really nicely built plugin, but I am wondering if there is a way to extend it for some extra custom functions (currently using flickr).

    What I am trying to do is to use your plugin to generate galleries from flickr, but also to show this information on a map and add a more data-rich features around the galleries. To do this, I would like to be able to access more of the data that is returned from the Flickr API. One way to achieve this would be to do two things:

    1. be able to get extra data from Flickr (not currently included in your queries).
    2. access more of the data that is returned from the API ideally as a raw array output instead of html, or alternatively some data could be added to the DOM via data attributes.

    Regarding #1, I am particularly interested in geo information. Flickr obviously can provide this and I can see that you are already passing flickr ‘extras’ and ‘primary_photo_extras’ in the Flickr modules, which can also include ‘geo’ as an option.

    Then for #2, either extra data (like geo data) could be included in the DOM (perhaps in html as data-latitude, data-longitude attributes). Alternatively, if it was possible to have either JSON or a PHP array returned from the shortcode (e.g. using output=json or output=raw in the shortcode) then I could call this in separate php which would enable more advanced usage.

    Thanks again for a well built plugin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    This is not something that is possible in the short-term horizon for Photonic.

    One thing that I have to consider while building a multi-platform plugin is that the output is consistent across all platforms, otherwise I run into hellish issues while integrating the output with lightboxes. A good example of this is video support, where each platform does videos differently, and each lightbox handles videos differently. Consequently it took me several weeks to add video support to the plugin.

    Something like geolocation is not a standard construct across all the platforms – only Flickr and SmugMug have it, while Google, Zenfolio and Instagram don’t. The next facet is, such data is not useful from the point of view of building lightboxes / galleries (which is really what Photonic is meant for – it is offered as a “Gallery & Lightbox” plugin). A similar example would be the desire to display comments against photos – some platforms support it and some don’t, and no lightbox integrates comments.

    While part 1 of your ask is easy (all I have to do is wrap the extras and primary_photo_extras in filters), part 2 is a different beast. Adding a data-latitude / data-longitude is a quick and dirty way (with an emphasis on dirty ;-), considering that geolocation is not a standard offering), and considering the effort that goes into keeping things standardized, it is not a path that I want to traverse. Doing a JSON / raw output is even harder from the point of view of standardization / UX.

    Hence my comment about this not being something I can accommodate in my short-term horizon. There are just too many variables that I will need to factor in.

    I will give it some thought, but there are quite a few other things in my pipeline that are of higher priority.

    Thread Starter jondho

    (@jondho)

    As a really blunt approach (and what I have implemented as a temporary workaround) is to add:

    if ($short_code['view'] == 'raw') {
      return $photos;
    }

    I have also added ‘geo’ to $flickr_params['extras'] and $flickr_params['primary_photo_extras'] (lines 123 & 124).

    inside the process_photos function in Flickr.php (line 607) and then just use a shortcode with view=’raw’. This could also go higher up in the switch statement of course.

    This has the effect of returning the full $photos object and means that I can call the shortcode (using do_shortcode) from another piece of php.

    This is obviously is not a proper solution and results in various unintended issues, but it does deliver the initial functionality that I am after.

    Thread Starter jondho

    (@jondho)

    Thanks for the reply and yes, fully understand that any changes need to be generic across other platforms. I haven’t looked in detail at the other platforms, although if they did each have various pieces of “extra” data (e.g. for flickr, geolocation and datetaken would be super useful), then perhaps these could be put in a generic “data-extra” html attribute (perhaps just as a comma or semicolon separated list… or even as json). Different platforms might return different pieces of “extra” data (or none) but would all return the content to the same data-extra attribute. This could mean that the mess gets kept at the level of the platform modules and higher up aspects like layouts etc just have to handle an extra attribute.

    If this was possible, then this would negate the need for a raw output because this data could be accessed for various purposes either from PHP (by parsing the DOM response returned when calling the shortcode via do_shortcode) or form JavaScript.

    For reference, what I am working on is only a private project and I will be integrating the use of your plugin with Toolset (https://toolset.com/) to dynamically construct galleries related to other data. As it is a private project, a bit of dirty hacking is fine and this is most likely an edge case in terms of functionality so I fully understand that.

    A final point is that searching by date and having the date returned with the photo all the way to the gallery would also be useful (as a standalone and probably (?) simpler comment from above).

    Best regards,
    Jonathan.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Raw output and extra flickr data output’ is closed to new replies.