• Resolved nelsondaniel

    (@nelsondaniel)


    Hey!

    I′ve been trying to show all images in a specific gallery in a blog post but cant seem to find a good solution.

    The images are saved in 3 formats: small (thumb), medium and large (original).

    What I want to achieve is to loop out all the medium images and when they are clicked the larger ones should open. In other words, I dont want to show the thumbnails in the blog. I could use a [singlepic] for every image but that would be veeeeery time consuming…

    Anyone have a good solution?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter nelsondaniel

    (@nelsondaniel)

    Am I the only one that want to publish larger images from a gallery without using alot of [singpic]′s? ??

    Thread Starter nelsondaniel

    (@nelsondaniel)

    I managed to create a function that does what I was looking for.
    I created a new shortcode called [singlepics_gallery id=your_gallery_id] and it shows all the images in a gallery with a with the Alt./Title shown underneath and the description as a link on the image. It will probably need som tweeking for it to work as you like it to.

    File: “plugins/nextgen-gallery/shortcodes.php”.

    I added this at line 23:
    add_shortcode( 'singlepics_gallery', array(&$this, 'show_singlepics_gallery' ) );

    I added this at line 182:

    //*** START MOD ***
    	function show_singlepics_gallery( $atts, $content = '' ) {
    
        	global $wpdb;
    
            extract(shortcode_atts(array(
                'id'        => 0
            ), $atts ));
    
            $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$id' ");
            if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$id' ");
    
            if( $galleryID )
            {
                $images = $wpdb->get_results("SELECT pid, post_id, galleryid, description, alttext FROM wp_ngg_pictures WHERE galleryid=".$galleryID, OBJECT_K);
    
                if($images)
                {
                    foreach ($images as $key => $image)
                    $out .= nggSinglePicture($image->pid, '530', '530', '', 'center', '', $image->alttext, $image->description)."<br /><br />";
                }
            }
            else
            {$out = __('[Gallery not found]','nggallery');} 
    
            return $out;
        }
        //*** END MOD ***

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: NextGen] Viewing many large/medium images’ is closed to new replies.