• Hi,

    in the page “gallery settings” i can choose a “preview image”. I want to show this preview in the page category.php, but i don’t know how to show it.
    I need help.

    Thx 🙂

    Gueblo

    ————-

    Bonjour,

    dans la page “gallery settings” je peux choisir une “preview image”, c’est-à-dire l’image qui ‘representera’ ma galerie. Le problème c’est que je ne sais pas l’afficher sur mon site. J’aimerais m’en servir comme “preview” dans la page category.php.

    Quelqu’un saurait-il m’aider ?

    Merci 🙂

    Gueblo.

    ——————-

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m using the following in my portfolio:

    <?php
    function getItemPreview()
    {
    	global $wpdb, $post;
    	$img_cat = $wpdb->get_row('SELECT * FROM '.$wpdb->nggallery.' WHERE gid = '. get_post_meta($post->ID, 'pf_nextgen_gallery', true) .' ORDER by gid DESC limit 0,1');
    	$first_image = $wpdb->get_row('SELECT * FROM '. $wpdb->nggpictures .' WHERE exclude != 1 AND galleryid = '. get_post_meta($post->ID, 'pf_nextgen_gallery', true) .' ORDER by pid DESC limit 0,1');
    
     	$albumPreview = $wpdb->get_results('SELECT pid, filename FROM '.$wpdb->nggpictures.' WHERE pid = '.$img_cat->previewpic.'', OBJECT_K);
    
    	$toppreview = get_option ('siteurl') . '/' . $img_cat->path . '/' . $first_image->filename;
    
    	if ( $previewimg = $albumPreview[$img_cat->previewpic]->filename )
    	{
    		$toppreview = get_option ('siteurl').'/' . $img_cat->path . '/' . $previewimg;
    		echo '<style type="text/css">#image { background-image:url('.$toppreview.')!important; }</style>';
    	}
    	else
    	{
    		echo '<style type="text/css">#image { background-image:url('.$toppreview.')!important; }</style>';
    	}
    }
    ?>

    As you can see I add a custom field pf_nextgen_gallery that stores the ID of the gallery I want the preview of on that page/post. Ofcourse the output can be changed according to your wishes 🙂

    thanx, illutic

    it’s very helpful.

    [spam link removed]

    OK… so where does the above code go? In the page template or elsewhere?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: NextGEN Gallery] picpreview’ is closed to new replies.