Support » Plugin: NextGEN Gallery - WordPress Gallery Plugin » Setting a Next Gen Image as a Featured Image with TimThumb

  • Hey all,

    I’ve been looking around the world wide web for a solution to setting a Next Gen image as my Featured Image (post_thumbnail) and through some trial and error, came up with this.

    Mind you, it’s not an end all be all, since it’s not conditional, but it’s a start. I’ll work on coming up with the conditional statement that gives us the ability to either use a standard WP attachment image OR the Next Gen image, but for now:

    <?php if ( has_post_thumbnail() ) :
    	echo '<div id="featured" class="block">';
    	$thumb = next_gen_get_attachment_image_src(get_post_thumbnail_id(),'full', true);/*wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' );*/
    	$url = $thumb['0'];
    	$width = 960; $height=300; $quality=100;
    	echo '<a href="'.$url.'" class="">';
    	echo '<img src="'.TIMTHUMB_PATH.'?src=' . $url . '&a=c&q='.$quality.'&w='.$width.'&h='.$height.'" width="'.$width.'" height="'.$height.'" class="" />';
    	echo '</a>';
    	echo '</div>';
    		else :
    <? endif; ?>

    Let me know what you think. Remember, you’ll have to have TimThumb installed 😉

  • The topic ‘Setting a Next Gen Image as a Featured Image with TimThumb’ is closed to new replies.