Digital experiences for all disciplines
New Landing › How can we help? › Cardinal › lightbox gallery thumbnails
New Landing › How can we help? › Cardinal › lightbox gallery thumbnails
- This topic has 14 replies, 4 voices, and was last updated 8 years by Swift Ideas – Ed.
-
Posted in: Cardinal
-
April 19, 2015 at 6:35 am #166255
Hi
I am trying to create a gallery with a grid of square thumbnails. when you click on the thumbnails the full images of various sizes (not squares) are displayed in lightbox.
spb_gallery only supports the masonry layout. spb_image turns off lightbox when entering a link to image.
How can I build my gallery?
Thank you
April 20, 2015 at 9:28 am #166370Hi
So you just want to crop the images to squares in the gallery?
– Kyle
April 20, 2015 at 3:26 pm #166498yes! thanks.
April 20, 2015 at 5:15 pm #166535Please provide me with a link and login so I can sort this for you
– Kyle
April 20, 2015 at 7:25 pm #166574Kyle, I just spoke with the client and they are ok with the gallery as is. Thanks for offering your help.
April 21, 2015 at 6:50 am #166698Ok no problem
February 15, 2016 at 9:02 am #249005Hi Kyle,
Any chance you can let me know how to achieve this – gallery with square thumbnails (cropped) that launches lightbox.
Thanks
GB
February 16, 2016 at 4:42 pm #249665Add this to your child theme functions.php file:
/* GALLERY THUMBNAIL ================================================== */ if ( ! function_exists( 'sf_gallery_thumbnail' ) ) { function sf_gallery_thumbnail( $display_type = "gallery", $link_type = "lightbox", $columns = "2", $gutters = "yes", $count = 0, $gallery_id = 0 ) { global $post, $sf_options; $gallery_thumb = $item_class = $link_config = ''; $thumb_width = 600; $thumb_height = 600; $video_height = 450; if ( $columns == "1" ) { $thumb_width = 1200; $thumb_height = 1200; $video_height = 900; } else if ( $columns == "2" ) { $thumb_width = 800; $thumb_height = 800; $video_height = 600; } else if ( $columns == "3" ) { $thumb_width = 600; $thumb_height = 600; $video_height = 450; } if ( $display_type == "masonry" || $display_type == "masonry-gallery" ) { $thumb_height = null; } $thumb_image = get_post_thumbnail_id(); $thumb_img_url = wp_get_attachment_url( $thumb_image, 'full' ); $item_title = get_the_title(); $item_subtitle = sf_get_post_meta( $post->ID, 'sf_gallery_subtitle', true ); $permalink = get_permalink(); $item_link = sf_gallery_item_link( $link_type, $gallery_id ); if ( $display_type == "gallery" || $display_type == "masonry-gallery" ) { $gallery_thumb .= '<figure class="animated-overlay overlay-style">' . "\n"; } else { $gallery_thumb .= '<figure class="animated-overlay overlay-alt">' . "\n"; } $image = sf_aq_resize( $thumb_img_url, $thumb_width, $thumb_height, true, false ); if ( $image ) { $gallery_thumb .= '<a ' . $item_link['config'] . '></a>'; $gallery_thumb .= '<img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />' . "\n"; $gallery_thumb .= '<div class="figcaption-wrap"></div>'; if ( $item_subtitle != "" && ( $display_type == "gallery" || $display_type == "masonry-gallery" ) ) { $gallery_thumb .= '<figcaption><div class="thumb-info">'; } else if ( $display_type == "standard" || $display_type == "masonry" ) { $gallery_thumb .= '<figcaption><div class="thumb-info thumb-info-alt">'; } else { $gallery_thumb .= '<figcaption><div class="thumb-info">'; } if ( $display_type == "gallery" || $display_type == "masonry-gallery" ) { $gallery_thumb .= '<h4 itemprop="name headline">' . $item_title . '</h4>'; if ( $item_subtitle != "" ) { $gallery_thumb .= '<div class="name-divide"></div>'; } $gallery_thumb .= '<h5 itemprop="name alternativeHeadline">' . $item_subtitle . '</h5>'; } else { if ( $item_link['svg_icon'] != "" ) { $gallery_thumb .= $item_link['svg_icon']; } else { $gallery_thumb .= '<i class="' . $item_link['icon'] . '"></i>'; } } $gallery_thumb .= '</div></figcaption>'; } $gallery_thumb .= '</figure>' . "\n"; return $gallery_thumb; } }
– Kyle
February 17, 2016 at 8:58 am #249812This reply has been marked as private.February 18, 2016 at 5:05 pm #250491Not sure why this isn’t working, it’s showing the full images instead of the sizes set in the php. Will check with the developer
– Kyle
February 19, 2016 at 2:54 am #250559HI GB,
The images will need to be at least 600px tall to be square, looks like they aren’t. Try editing lines 9/10 of the code provided to:
$thumb_width = 400; $thumb_height = 400;
– Ed
February 23, 2016 at 10:04 am #251353Hi Ed / Kyle,
Apologies didn’t get your reply last week.
I’ve made the change you suggested and also tried a few other variables (100 / 200 / 300 px) but doesn’t seem to have any effect at all?
If it helps – the images in the gallery are only placeholders, the smallest of which is 531px wide.
Thanks
GB
February 23, 2016 at 6:13 pm #251588Apologies – a little bit of confusion here, the above code doesn’t actually affect that widget. We’re just in the process of prepping the next Swift Framework plugin update, and in that update we have added the ability to select the image size for that element, so that you can restrict it to be 250×250 square thumb image for example. We are expecting to release this in the next 24-48 hours, but I can send over sooner if needed?
– Ed
February 23, 2016 at 8:38 pm #251616Hi Ed,
No problems, we’ll sit tight. Thanks for the faultless support as ever.
GB
February 23, 2016 at 8:39 pm #251617No problem, happy to help!
– Ed
-
Posted in: Cardinal
You must be logged in and have valid license to reply to this topic.