• Hi, this is a great plug-in!

    I’d like to be able to link the images to individual pages within a website because I want to use it for e-commerce. So that when someone sees an item they want to purchase, they can click the image and be taken to the page describing the item.

    Is this on a wish-list, or can it actually be accomplished now?

    MANY THANKS!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael D

    (@michael-divine)

    I would use the Custom Fields plugin:
    http://nextgen-gallery.com/custom-fields/

    Add your field…

    then, after creating a custom field called URL for the images, change line 22 of the singlepic.php file in the “view” folder from this:

    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->linktitle ?>" <?php echo $image->thumbcode ?> >
    	<img class="<?php echo $image->classname ?>" src="<?php echo $image->thumbnailURL ?>" alt="<?php echo $image->alttext ?>" title="<?php echo $image->alttext ?>" />

    to this:

    <a href="<?php echo $image->ngg_custom_fields["URL"]; ?>"><img class="<?php echo $image->classname ?>" src="<?php echo $image->thumbnailURL ?>" alt="<?php echo $image->alttext ?>" title="<?php echo $image->alttext ?>" /></a>

    that should work…

    WilliamJames

    (@williamjames)

    Hiya – I am attempting the same workaround. I have custom fields installed but I’m sure I have not created the image custom field correctly – Field Name = URL – Field Type = Text Input (?) linked to my gallery. Modifying singlepic.php poses no problem, but I am at a loss to see how I will be able to place and specify the URL’s I am hoping to send visitors who select the images. The ‘lightbulb’ could also be larger and the alt text would be better suited as something like ‘read more’. Would I find these specs in the same file?

    Would appreciate some guidance,

    Cheers!! William

    WilliamJames

    (@williamjames)

    I may have found an alternative workaround. Using the commands in nggSmoothSharedFunctions.php :

    // Error with only one element
    foreach ($pictures as $picture)
    if ($picture[“img”]) {
    $out .= “<div class=\”imageElement\”>”;
    $out .= ” <h3> ” . $picture[“title”] . “</h3>”;
    $out .= ” <p style=\”color: #FFF000;\”> ” . $picture[“desc”] . “</p>”;
    $out .= ” <<<<“;
    $out .= ” <img src=\”” . $picture[“img”] . “\” class=\”full\” />”;
    $out .= ” <img src=\”” . $picture[“thumb”] . “\” class=\”thumbnail\” />”;
    $out .= “</div>”;
    }

    $out .= ‘ </div></div>’;

    return $out;
    }

    It should be possible, IO am assuming, to modify line:

    $out .= ” <<<<“;

    [note I have altered the hover-over text for this] to call a page I can attribute to each image…hhhhmmmmmm still drawing board stuff, but closer. I would also like the carousel ‘thumbnails’ to behave in the same way, i.e. link to a page (on the site btw) corresponding to the image – they are covers of ‘zines.

    WilliamJames

    (@williamjames)

    I may have found an alternative workaround by modifying nggSmoothGalleryFunctions.php:

    This section:

    // Error with only one element
    foreach ($pictures as $picture)
    if ($picture[“img”]) {
    $out .= “<div class=\”imageElement\”>”;
    $out .= ” <h3> ” . $picture[“title”] . “</h3>”;
    $out .= ” <p style=\”color: #FFF000;\”> ” . $picture[“desc”] . “</p>”;
    $out .= ” <(a) target=\”_blank\” href=\”” . $picture[“link”] . “\” title=\”read more\” class=\”open\”></(a)>”;
    $out .= ” <img src=\”” . $picture[“img”] . “\” class=\”full\” />”;
    $out .= ” <img src=\”” . $picture[“thumb”] . “\” class=\”thumbnail\” />”;
    $out .= “</div>”;
    }

    $out .= ‘ </div></div>’;

    return $out;
    }

    By modifying this [note I have altered the mouse-over text]:

    $out .= ” <(a) target=\”_blank\” href=\”” . $picture[“link”] . “\” title=\”read more\” class=\”open\”></(a)>”;

    It should be possible, I am assuming, to link each image to a specific page (on the site) I would also like the ‘thumbnails’ in the carousel to behave the same. Still drawing board, but closer!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: NextGEN Gallery] How to link image to a specific page (URL)’ is closed to new replies.