Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Wordpress NextGen (Search engine Plugin) Image Links don´t open WordPress

  • SOLVED

Hello,

I´m using Nextgen Gallery Plugin with imagebrowser feature to display my portfolio (see example here: [[LINK href="http://www.heliocristovao.net/portfolio"]]http://www.heliocristovao.net/portfolio[[/LINK]])

As I wanted to search for images, I installed the [[LINK href="http://alexrabe.de/2010/01/13/search-for-images/"]]NextGEN Search Engine 0.7.0[[/LINK]] and the search page is beautiful and fully integrated in the theme.

Now, the problem is that since I´m using 'imagebrowser' to display my images, and also (nextgen) permalinks activated - the image links on the search pages aren´t working. And I´m seeking a code fix for this and I would appreciate your help. Please see example search page here: [[LINK href="http://www.heliocristovao.net/?s=sintra"]]http://www.heliocristovao.net/?s=sintra[[/LINK]]

(Many nextgen seach engine plugin users are having this trouble).

The link for the plugin source code is below
[[LINK href="http://nextgen-gallery.googlecode.com/files/nggSearch-v0.7.0.zip"]]NextGEN Search Engine 0.7.0[[/LINK]]


Thank you
H. Cristovao

PS - Help topic posted in WP Forums: [[LINK href="http://wordpress.org/support/topic/nextgen-image-search-link-page-do-not-open-in-imagebrowser?replies=1"]]http://wordpress.org/support/topic/nextgen-image-search-link-page-do-not-open-in-imagebrowser?replies=1[[/LINK]]

Answers (3)

2011-07-05

Svilen Popov answers:

Open <strong>wp-content/plugins/nextgen-gallery/view/gallery.php</strong> and find the following code <em>(~ line 37)</em>:


<!-- Thumbnails -->
<?php foreach ( $images as $image ) : ?>
<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
<div class="ngg-gallery-thumbnail" >
<a href="<?php echo $image->imageURL; ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
<?php if ( !$image->hidden ) { ?>
<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
<?php } ?>
</a>
</div>
</div>


Replace it with the following code:

<?php
if(isset($_GET['s'])) {
global $wpdb;
$pics_table = $wpdb->prefix.'ngg_pictures';
$gallery_table = $wpdb->prefix.'ngg_gallery';
$tmp_img = $wpdb->get_row("SELECT `galleryid`, `image_slug` FROM `$pics_table` WHERE `pid`='$image->pid'");
$tmp_img_slug = $tmp_img->image_slug;
$tmp_gid = $tmp_img->galleryid;
$tmp_gallery = $wpdb->get_row("SELECT `slug` FROM `$gallery_table` WHERE `gid`='$tmp_gid'");
$tmp_gallery_slug = $tmp_gallery->slug;
$new_tmp_link = 'http://www.heliocristovao.net/portfolio/'.$tmp_gallery_slug.'/gallery/image/'.$tmp_img_slug.'';
}
else {
$new_tmp_link = $image->imageURL;
}
?>
<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
<div class="ngg-gallery-thumbnail" >
<a href="<?php echo $new_tmp_link; ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
<?php if ( !$image->hidden ) { ?>
<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
<?php } ?>
</a>
</div>
</div>



Hélio Cristóvão comments:

Thanks Svilen, after trying this, everything works just as intended.
Well done!

Hélio

2011-07-03

Duncan O'Neill answers:

Hi,

your problem may be caused by the huge long strings containing markup in your title attribute of the <a> tags surrounding the images.

You should be able to fix that problem by going back and entering new titles, without markup attributes, in your image editor.

That may in turn fix your other problem.

best,

Duncan


Duncan O'Neill comments:

Helio,

another idea, which you probably want to check out. Alex Rabe ( the plugin author )'s latest post on his site mentions problems with a recent version of the plugin re peramlink structure, and gallery permalinks. [[LINK href="http://alexrabe.de/"]]http://alexrabe.de/[[/LINK]]


Hélio Cristóvão comments:

Duncan, I checked the latest post from Alex, about the permalink structure, I guess it´s only applicable on blog post entries: /%postname%/ or /%category%/%postname%/ ) but I´m not sure.

To solve my issue, I think what´s needed is some code adding/modification in NGGsearch.php from the source code of the plugin:

[[LINK href="http://nextgen-gallery.googlecode.com/files/nggSearch-v0.7.0.zip"]]NextGEN Search Engine 0.7.0[[/LINK]]

2011-07-03

Peter Michael answers:

If you look at the plugin's header notes:
@ToDo : Rewrite rules doesn't work with search pagination


Hélio Cristóvão comments:

Thanks, that should refer to the code missing for my use of the search engine to work.

Any help to improve the plugin functionality and add the code so it can work in search pagination?