New Landing How can we help? Cardinal lightbox gallery thumbnails

Viewing 15 posts - 1 through 15 (of 15 total)
  • Posted in: Cardinal
  • #166255
    JeffDSmith
    Member
    Post count: 31

    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

    #166370
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    So you just want to crop the images to squares in the gallery?

    – Kyle

    #166498
    JeffDSmith
    Member
    Post count: 31

    yes! thanks.

    #166535
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Please provide me with a link and login so I can sort this for you

    – Kyle

    #166574
    JeffDSmith
    Member
    Post count: 31

    Kyle, I just spoke with the client and they are ok with the gallery as is. Thanks for offering your help.

    #166698
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok no problem

    #249005
    thebeesons
    Member
    Post count: 85

    Hi Kyle,

    Any chance you can let me know how to achieve this – gallery with square thumbnails (cropped) that launches lightbox.

    Thanks

    GB

    #249665
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Add 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

    #249812
    thebeesons
    Member
    Post count: 85
    This reply has been marked as private.
    #250491
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Not 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

    #250559
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    HI 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

    #251353
    thebeesons
    Member
    Post count: 85

    Hi 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

    #251588
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Apologies – 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

    #251616
    thebeesons
    Member
    Post count: 85

    Hi Ed,

    No problems, we’ll sit tight. Thanks for the faultless support as ever.

    GB

    #251617
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    No problem, happy to help!

    – Ed

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register