I would love to see Media Entity Flickr support Colorbox. The older Flickr module (D7) supports Colorbox (and Lightbox), and the issue about its integration is here. Also, as a reference, the View Embed Field module now supports both D8 core Media (formerly Media Entity) and Colorbox. I'm not a coder but presumably the code from those modules can be adapted and integrated into this module?

Comments

Nick Hope created an issue.

dakku’s picture

Hi Nick,
Thank you again for your input. I think this will be useful functionality to incorporate. Time on my side is quite busy with client projects, so I would very much welcome patches if someone else can work on this.

jack_ry’s picture

Hi Nick,

Once you copied the embed code of a flicker image add these two classes "colorbox cboxElement" to the anchor tag and replace the href with the img src path.

This is not friendly/dynamic, but it will be a quick workaround.

Note: Colorbox module should already be installed

nick hope’s picture

Thank you @jack_ry. I'm displaying Flickr images as Media items in Views, and I can't work out a way to apply your suggestions in that scenario. I tried adding those classes in Style Settings in my View but unfortunately the Flickr iFrame just appears full size, not in a modal.

I would prefer the full Flickr iFrame, rather than just an embedded image, but I would be happy with the latter, as I am adding all necessary attribution in other ways. My workaround for the time being is to apply Colorbox to the thumbnail field, which allows me to display the full size image in a Colorbox modal window, but I want the full size image to be hosted by Flickr, not by my server. Maybe there's a way to add a remote image from a generic image URL as a Media entity, but I can't find it.

jack_ry’s picture

If you're using the embed code of a flicker image then it is possible to apply the solution in views.

In views, Under formatter option for the media field choose rendered entity.

Adding those classes in the views will not be helpful. You have to add them in the media field itself. I believe you have followed the installation instructions of media_entity_flickr module. Once you are done with that, you will be adding media under Content tab where you will find the media field. Here you have to add the class with the embed code of a flicker image. This media will then be referenced in a content type as reference field which will eventually show up in the view of that content type. And colorbox will work like a charm.

nick hope’s picture

Below is a sample Flickr embed code, exactly as I have been using. How should I change this to achieve what you suggest?

<a data-flickr-embed="true" href="https://www.flickr.com/photos/73735208@N04/6767670363/in/photolist-bj35BM-iKQQcf-bpcg5t-bo4RE-eeow2b-9Bhz1-dxBvdv-dbYXSM-DKJop-agMcZc-xjizw-J77vk-dbZ89t-b6tSi-9abTLo-RmF6QT-6xcFLL-5xxHBz-dbYMHv-dbZmrh-bV2MET-dbYBVc-4CFGLU-9KFHqq-dWTZe-ab4F2L-CB8wEf-aK17o-EfPcGW-dKT78-dKQEL-TdQL4Y-349S1-DcVtYt-CnNZ9M-LpajLv-CLGyUz-LmwCnE-xZSCn3-L5CRJS-Lw4VUv-P4NVcM-sARtKj-oasmip-o8HoB9-kTHymC-ccp3GC-bUYNYq-butxBN-8ZheXb" title="African safari - Photo Montage 2012"><img src="https://farm8.staticflickr.com/7019/6767670363_e5dbd640f7_o.jpg" width="900" height="600" alt="African safari - Photo Montage 2012"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>

jack_ry’s picture

href="https://farm8.staticflickr.com/7019/6767670363_e5dbd640f7_o.jpg" class="colorbox cboxElement"
title="African safari - Photo Montage 2012">Only local images are allowed. src="https://farm8.staticflickr.com/7019/6767670363_e5dbd640f7_o.jpg"
width="900" height="600" alt="African safari - Photo Montage
2012">

charset="utf-8">

Replace the href of anchor tag same as the src of img tag and add those two classes after href like the above one

Let me know if you still can't make it to work

nick hope’s picture

Thank you. Your code got a bit mangled. Anyway, I've got this working for images from any external provider, not just Flickr, using this simple code:

<a href="IMAGE-URL" class="colorbox cboxElement" title="TITLE-TEXT"><img src="IMAGE-URL" alt="ALT-TEXT"></a>

Then in my CSS for my View I have this, to reduce the give a thumbnail effect to the non-Colorbox images:

.colorbox img {
    max-width: 200px;
    max-height: 200px;
}

To be clear, I'm still using the Media Entity Flickr module to do this.

3 drawbacks to this are:

1. I can't think of a way to use a real thumbnail, so the full size images are always loading here, which is generally slow.
2. I don't think it's possible to use image grouping, so that the image appears in a post or page gallery (i.e. click through all images from the Colorbox window).
3. I don't think a custom Colorbox caption with tokens is possible.
4. Manually entering the code is a bit messy, and not something that you'd want to trust to regular users.

Anyway, at least the remote servers fund the bandwidth now, and not mine :)

As an aside, I am puzzled why there are these provider-specific Media Entity modules for Flickr, Instagram etc., but none for a generic provider, that would cover images from any URL. I did ask about that here and here, but no joy.

dakku’s picture

@nick I have ported Flickr module to D8 as well.

If you are looking to implement flickr blocks and flickr filters (D7 style), you may want to try out the Flickr D8 version https://www.drupal.org/project/flickr

Also see colorbox integration for flickr. https://www.drupal.org/project/flickr/issues/2954050

nick hope’s picture

@dakku Thanks for that. Sorry for the slow reply. I did install it but I don't think it really helps my situation because of the way I've built my site using Media entities.

I have been hacking this stuff around for hours today to try and get a solution. I looked at pulling your new Colorbox support from the Flickr module into this module, and alternatively at somehow porting the Colorbox support from the Video Embed Field module. Colorbox support seemed to be achieved in very different ways in both. The latter seemed like a reasonable bet because it supports D8, Media & Colorbox, so I was hoping I could effectively drop a Flickr iFrame in place of the YouTube/Vimeo iFrame.

What I'm hoping is that the full Flickr embedded iFrame (with branding) could appear in a Colorbox window, so that the required attribution and link back to Flickr are handled automatically. Also hoping that "Gallery (image grouping)" is supported, so that it's possible to click from image to image without closing the Colorbox. But I fear these 2 wishes might be incompatible (there does not seem to be Gallery support in Video Embed Field).

I've also been trying to create a generic "Media Entity Remote Image" module that simply provides a media entity for a generic remote image from any site or server (not just Flickr, Instagram, Imgur) that supports hotlinking. I'm a little surprised that such a thing doesn't exist yet.

I'm not a programmer and haven't had success with any of this yet. It's pretty important for my project, so I do have a budget to sponsor some of this development if you or anyone else is interested.

dakku’s picture

@nick
Please check your email.