• Resolved ivanotls

    (@ivanotls)


    Hi guys,

    I’d like to uses the code [ singlepic id=x …] as an image which redirect to a another page of my site when the user click on it.

    something like

    href=”www.google;com” <img src=[ singlepic id=1OO]

    thank u

Viewing 9 replies - 1 through 9 (of 9 total)
  • Well, that can’t possibly work. If you can’t work out the image’s URL yourself, i’d suggest you add the singlepic without the link. Then view that page in your browser (using “preview”, maybe). Right click on the image and select “copy image location” (or whatever the menu item is in your browser) and then paste that into the img src= statement inside your href tag, as above.

    I hacked up a similar solution in a few minutes. This is for NextGEN Gallery 1.3.5

    Copy singlepic.php in the view directory to singlepic-link.php and edit the file. We’ll make a template for it.

    On line 19, where it says

    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->linktitle ?>" <?php echo $image->thumbcode ?> >

    change to

    <a class="Link" href="<?php echo $link ?>">

    In shortcodes.php in the lib directory, find line 170

    'template' 	=> ''

    and change to

    'template' 	=> '',
    'link'          => ''

    And on line 173 change

    $out = nggSinglePicture($id, $w, $h, $mode, $float, $template, $content);

    to

    $out = nggSinglePicture($id, $w, $h, $mode, $float, $template, $content, $link);

    Then call it like this

    [singlepic id=1 w=150 h=150 template=link link=http://www.google.com]

    The function will output a thumbnail and linking to the url you specified.

    Thread Starter ivanotls

    (@ivanotls)

    thank u you very much, this hack can be suggested to the author of nextgen, I think can be a useful extension for everyone

    Hi, tried the hack by andreask. The short code manages to generate the right html code with the <a href> anchor. However, it’s empty where it’s supposed to print the link address. Is there something I could have missed out?

    Thanks.

    Sorry for the double but I figured out what’s wrong and can’t edit my previous post.

    You need to edit nggfunctions.php in your nextgen-gallery root directory

    Replace line 594 from

    function nggSinglePicture($imageID, $width = 250, $height = 250, $mode = ”, $float = ” , $template = ”, $caption = ”) {

    to

    function nggSinglePicture($imageID, $width = 250, $height = 250, $mode = ”, $float = ” , $template = ”, $caption = ”, $link = ”) {

    and add after line 649

    $picture->link = $link;

    I also managed to edit the TinyMCE function on the writing toolbar which is rather length so I illustrate here.

    PS: Check back in half hour or so while I write out the details.

    SubSanity: You are right. Sorry I missed this. While figuring out where I did that hack, I removed everything I did and tested what did work. I thought I didn’t need any modifications to nggfunctions.php, but I forgot to upload the clean nggfunctions.php and test.

    I did the two changes you posted here, and I also added it on this line:

    $out = nggGallery::capture ( $filename, array ('image' => $picture , 'meta' => $meta, 'exif' => $exif, 'iptc' => $iptc, 'xmp' => $xmp, 'link' =>$link) );

    Not sure which line it is, or if it’s needed, but according to what you posted, it’s not needed.

    Andreask & SubSanity

    Thanks for your feedback and ideas. I’ve added the link parameter to the next release : http://code.google.com/p/nextgen-gallery/source/detail?r=587

    Hello!

    I am trying to do the exact opposite of this. On my page I have an album displaying with [ imagebrowser= 1 ]. It has previous/next with descriptions all working correctly. On the same page I have a list of links – I would like these links to affect the imagerbrowser and goto a specific image in the album but continue to function normally from that point.

    Here is the page I am working on.

    Thanks,
    rich

    The new nextgen version has incorporated the code for linking

    heidi

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: NextGEN Gallery] How-to use [ singlepic id=100] as an image for HREF’ is closed to new replies.