Hi Alex,
I resolved it
I added the tag [singlelinkpic=”text-to-link”,id]
I added following code in nggfunction.php line 32
if ( stristr( $content, ‘[singlelinkpic’ )) {
$search = “@\[singlelinkpic=(\”.+\”),(\d+)\]@i”;
if (preg_match_all($search, $content, $matches)) {
if (is_array($matches)) {
foreach ($matches[2] as $key =>$v0) {
// check for correct id
$result = $wpdb->get_var(“SELECT filename FROM $wpdb->nggpictures WHERE pid = ‘$v0’ “);
if($result){
$search = $matches[0][$key];
$replace= nggLinkSinglePicture($v0,$matches[1][$key]);
$content= str_replace ($search, $replace, $content);
}
}
}
}else{$content= “falso”;}
}// end singelpic
and I added the function nggLinkSinglePicture:
function nggLinkSinglePicture($imageID, $linktxt=””) {
/**
* create a gallery based on the tags
* @imageID db-ID of the image
* @linktxt txt to link to image
*/
global $wpdb, $post;
$ngg_options = nggallery::get_option(‘ngg_options’);
// remove the comma
$linktxt = trim($linktxt,’\”‘);
// get picturedata
$picture = new nggImage($imageID);
// check fo cached picture
if ( ($ngg_options[‘imgCacheSinglePic’]) && ($post->post_status == ‘publish’) )
$cache_url = $picture->cached_singlepic_file($width, $height, $mode );
// add fullsize picture as link
$out = ‘imagePath.'” title=”‘.stripslashes($picture->description).'” ‘.$picture->get_thumbcode(“singlepic”.$imageID).’ >’;
$out .= $linktxt;
$out .= ‘‘;
$out = apply_filters(‘ngg_show_singlepic_content’, $out, $picture );
return $out;
}
I hope you can add this feature to next release of your code 🙂
bye
Vik