WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGEN Gallery] what about link text to photo? (8 posts)

  1. ilvikingodotnet
    Member
    Posted 5 years ago #

    Hi, I'm looking for the way to link an image in the gallery to some text in the post/page. Is it possible?
    Please let me know!
    Bye

  2. ilvikingodotnet
    Member
    Posted 5 years ago #

    And so? nobody have the same problem?
    Tnks

  3. Alex Rabe
    Member
    Posted 5 years ago #

    A singlepic or a image inside a gallery view ?

  4. ilvikingodotnet
    Member
    Posted 5 years ago #

    Hi Alex,
    Like "Singlepic", but the link is a text or an icon end not the image.
    Thanks!!

  5. ilvikingodotnet
    Member
    Posted 5 years ago #

    Hi, is there a trick or I have to link manually all my foto?

  6. ilvikingodotnet
    Member
    Posted 5 years ago #

    up

  7. ilvikingodotnet
    Member
    Posted 5 years ago #

    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

  8. zeusis
    Member
    Posted 5 years ago #

    I don't think this is working with the latest NextGen. Could this be updated for the lastest 1.01?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.