simple-lightbox icon indicating copy to clipboard operation
simple-lightbox copied to clipboard

Add-on: Featured Images

Open daninthemix opened this issue 12 years ago • 6 comments

This is not an issue but a question - I need a lightbox plugin that allows you to click on a post's featured image to display the full resolution copy of that image. The other thing I'd like is for this to ONLY be an option when the featured image is larger than what is currently displayed, as my site has a lot of images which already display at full res, but some that are much larger and for those I'd like users to be able to click the featured image, but only for those.

Would this plugin be what I need?

Thanks :)

daninthemix avatar Apr 09 '13 17:04 daninthemix

SLB currently works on links within a post's (page, custom post type, etc.) or widget's content. Featured images will be supported in a future update

archetyped avatar Apr 10 '13 02:04 archetyped

Do you have an ETA on the future update, and will it be able to do the other things I mentioned - such as only act when it determines that a featured image is not displaying at full res?

daninthemix avatar Apr 10 '13 12:04 daninthemix

Sorry, no timelines for future updates.

Working with featured images in particular is a loaded task because different themes make use of featured images differently. For example, many themes wrap the image in a link to the post's permalink. We clearly wouldn't want to override the link's standard behavior by displaying an image in the lightbox when a user clicks on it.

As for conditionally activating SLB, you can use logic in your theme file for that. Since the thumbnail's size is specified in the theme, it would be a small matter to determine if the original image is larger. For example, here's WP's official documentation for linking a thumbnail to the full-size image

archetyped avatar Apr 11 '13 05:04 archetyped

I am trying to see why Lightbox isn't being activated on http://www.hcede.nl/assortiment/houtconstructies/bruggen/hardhouten-brug-3~1403/. Looking at the classes I see a data-slb-active and data-slb-internal but when I click on the image I don't get a lightbox. Any help would be appreciated.

MikevHoenselaar avatar Sep 17 '13 09:09 MikevHoenselaar

@MikevHoenselaar: SLB does not appear to be activated on the site that you provided.

If you are still experiencing an issue, please create a new ticket specifically for your issue as it does not appear to be related to this ticket.

Thanks.

archetyped avatar Sep 18 '13 00:09 archetyped

@daninthemix you might fix this already by using the slb_activate() functionality. I've updated my content-single.php, adding this function to activate the Lightbox for my featured images. This might not be a need fix as it requires coding. but it is definitely a successful work-a-round. Hope this helps you!

<?php
    $thumb = get_post_thumbnail_id();
    $img_url = wp_get_attachment_url( $thumb,'full' );
    $image = aq_resize( $img_url, 780, 400, true ); //resize & crop the image

if($image){
    echo slb_activate(
            '<a href="'. $image .'"> <img class="image-responsive" src="'. $image .'" > </a>'
        );
}
?>

foxysolutions avatar Nov 21 '15 15:11 foxysolutions