-
AuthorPosts
-
March 16, 2021 at 4:30 pm #1288562
Hello, Kriesi team,
On this page, when clicking the “Polystar’s Product Portfolio” image about halfway down, a lightbox opens with a 1200px version of the image. However, I want to display the full version, which is 2300px wide.
In the back-end, I have explicitly selected the full-size version of the image in the Image module.
How can I get the full-res version to display?
Thanks!
Matt.March 21, 2021 at 10:07 pm #1289522Hey 2SINN,
Sorry for the very late reply and thanks for your patience and the login to your site, I didn’t login though instead I copied your full-size image to my localhost and tried a few different “solutions” from the past to try to find one that would work for this.
So for your image please add the custom classopenfullsize
Then add this code to the end of your functions.php file in Appearance > Editor:function custom_script() { ?> <script> (function ($) { $(document).ready(function(){ $('.openfullsize .avia-image-overlay-wrap .avia_image.lightbox-added').click(function(){ var fullsize = $(this).find('img').attr('src'); $('img.mfp-img').attr("src", fullsize); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
This will work and should not cause any conflicts because of the custom class, please note that it is still important that the “full-sized” image is explicitly selected in the image element.
Best regards,
MikeMarch 26, 2021 at 12:19 pm #1290531Hey Mike, thanks for your response, and no worries about the delay! In fact, it turned out the full-size display wasn’t necessary to comply with our client’s wishes after all. That said, your workaround is much appreciated and I’m keeping this for future use.
March 26, 2021 at 1:07 pm #1290548or you use some filters on that:
// for image lightbox setting function change_lightbox_size() { return "full"; } add_filter('avf_avia_builder_helper_lightbox_size','change_lightbox_size', 10); // this for masonry-galleries function avia_change_masonry_thumbnail_link($size){ return "full"; } add_filter('avf_avia_builder_masonry_lightbox_img_size', 'avia_change_masonry_thumbnail_link', 10, 1); // Guess this will work too for galleries and masonries function avia_change_gallery_thumbnail_link($link, $attachment, $atts, $meta){ $link = wp_get_attachment_image_src($attachment->ID, "full"); return $link; } add_filter('avf_avia_builder_gallery_image_link', 'avia_change_gallery_thumbnail_link', 10, 4);
March 26, 2021 at 2:00 pm #1290567Hi,
@2SINN glad to hear, @Guenni007 thank you for your input 🙂Best regards,
Mike -
AuthorPosts
- The topic ‘Image won't display at original size in lightbox’ is closed to new replies.