• I’m trying to display the large image, not the thumbnail, in my album listing. See http://clients.pixelalchemy.com/rsl2/?page_id=92 . I’m trying to put a big image in the rollover on the right column.

    Currently, I’m using $gallery->previewurl to display the thumbnail, but I need the larger version due to the size. Ideally, I’d like to access $image->imageURL available in gallery.php, but I can’t figure out how to address it from the album level.

    I’d be happy to settle for the first, or default image for the first item in the gallery, but ideally would be able to access the large version of the gallery preview image.
    My relevant code:

    <!-- 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>
    
    	<?php if ( $image->hidden ) continue;
    	if ( $gallery->columns > 0 && ++$i % $gallery->columns == 0 ) {
    		print '<br style="clear: both" />';
    	}
    	endforeach; ?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • looks like you have it working. Is the code above valid for this?
    Exactly what I am looking to do!
    Thanks.

    Thread Starter davesnothere

    (@davesnothere)

    Valid as in does it validate? Didn’t bother to check. It works, and what is posted is the same code I am using for the page you are viewing. I haven’t had any errors from it; although, I didn’t check for IE6 compatability on this project, since the client didn’t pay for it.

    Not sure I have my settings correct in ngg.
    Where do you have $gallery->previewurl set?
    I have a single “thumbnail” image showing at this point, with navigation below it.
    That is obviously wrong.

    Thread Starter davesnothere

    (@davesnothere)

    Sorry, I was out of town for the weekend.

    Here’s what I did:
    I created a page in the admin area, and put the following:
    [album id=5 template=list]

    I then modified one of the existing templates, extended I believe, saved it as ‘wp-content/pluging/nextgen-gallery/view/album-list.php’. Here’s the file:

    <?php
    /**
    Template Page for the album overview (extended)
    
    Follow variables are useable :
    
    	$album     	 : Contain information about the album
    	$galleries   : Contain all galleries inside this album
    	$pagination  : Contain the pagination content
    
     You can check the content when you insert the tag <?php var_dump($variable) ?>
     If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?>
    **/
    ?>
    <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($galleries)) : ?>
    
    <div class="ngg-albumoverview">
    	<!-- List of galleries -->
    	<h2><?php echo $album->name ?></h2>
    <?php echo $album->albumdesc ?>
    	<div>
    	<?php foreach ($galleries as $gallery) :
    	$pattern = '@thumbs/thumbs_@';
    	$gallery_image = preg_replace($pattern, '', $gallery->previewurl);
    ?>
    		<p class="swapImage { sin: ['#poster:<?php echo $gallery_image ?>'], sout: ['#poster:<?php echo $gallery_image ?>'] }"><a href="<?php echo $gallery->pagelink ?>"><?php echo $gallery->title ?></a></p>
    
     	<?php endforeach; ?>
    	</div>
    
    	<!-- Pagination -->
     	<?php echo $pagination ?>
    </div>
    
    <?php endif; ?>
    </div>
    <div id="rightcol">
    
    <p><img id="poster" src="wp-content/uploads/2010/10/blank.gif" alt="" height="400" /></p>

    The code at the bottom is the div on the right where the image loads. A bit sloppy, but I was already way over budget at the time, and had to be quick and dirty.

    The rollover event itself is handled by jquery. Read my comments on this thread to get jquery working on your page without breaking things: http://wordpress.org/support/topic/adding-your-own-js-without-breaking-wp-plugin-js-scripts?replies=3

    As for $gallery->previewurl, it’s set somewhere else (by the nextgen code), and I’m just leveraging that. At the end of your php file, put in: var_dump($galleries);That will give you a listing of all the variables available to you. That’s what the comment ” You can check the content when you insert the tag <?php var_dump($variable) ?>” is talking about. This thread might help some as well: http://wordpress.org/support/topic/plugin-nextgen-gallery-list-of-options?replies=7

    What I did around line 22 of the large chunk of code I pasted above:

    <?php foreach ($galleries as $gallery) :
    	$pattern = '@thumbs/thumbs_@';
    	$gallery_image = preg_replace($pattern, '', $gallery->previewurl);
    ?>

    is walked the $galleries array (provided by the nextgen engine), and stripped out some of the pathing to make things work.

    HTH

    Thanks for the detailed information.
    I attempted to get this working, but my image in the right column didn’t ever show up.
    The Album name, the gallery links did work.
    Just getting the blank.gif on the right so far. I have not spent a lot of quality time with this yet.
    Already have jquery running as part of my theme (hybrid).

    Thread Starter davesnothere

    (@davesnothere)

    My initial guess is that the pathing isn’t correct. Do you have a URL I can look at? Or, post the code?

    Let’s look at the code again, with comments; maybe you can figure out what isn’t working for you.

    First, I noticed when I added var_dump($galleries);, and after some digging, that the path for the large image is nearly identical to the path for the thumbnail, previewurl. Only, the large image isn’t available to me in $galleries (It is avaiable in $images, but that’s useless to us here as $images isn’t available in this php file.)

    <?php foreach ($galleries as $gallery) : //this lets me look at each entry in the galleries array, and reference it as gallery
    	$pattern = '@thumbs/thumbs_@'; //here is the difference in the path between the thumbs and regular image. I could also write this as '/thumbs\/thumbs_/' but that looks awkward, so I took advantage of perl's ability to use any character to limit the search.
    	$gallery_image = preg_replace($pattern, '', $gallery->previewurl); //define the new path to use below for the full size image. By default, previewurl is the thumb of the first image in the gallery.
    ?>
    		<p class="swapImage { sin: ['#poster:<?php echo $gallery_image ?>'], sout: ['#poster:<?php echo $gallery_image ?>'] }"><a href="<?php echo $gallery->pagelink ?>"><?php echo $gallery->title ?></a></p>
    
     	<?php endforeach; ?>

    Try this, substitute the following code:

    <?php foreach ($galleries as $gallery) :
    ?>
    		<p class="swapImage { sin: ['#poster:<?php echo $gallery->previewurl ?>'], sout: ['#poster:<?php echo $gallery->previewurl ?>'] }"><a href="<?php echo $gallery->pagelink ?>"><?php echo $gallery->title ?></a></p>
     	<?php endforeach; ?>

    You’ll get the thumbnail. If that doesn’t work, I’ll have to look at your page or your code to help more.

    Still not having any luck.
    Here is my URL for the page in question. It is at the bottom of the page.
    gggallery

    the swapimage id=”x” is not showing up when I inspect the page.

    Thread Starter davesnothere

    (@davesnothere)

    I sent you an email thru your website form. Let’s take this offlist to figure out what is going on.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: NextGEN Gallery] show gallery image(not thumbnail) in album’ is closed to new replies.