I have developed a workaround. This works really well for a ‘side orientated’ gallery, to be accompanied by text in a post.
See https://rigidkitchen.net/archives/happy-holidays
Here’s my template file. You’ll notice I have some PHP that looks for an gallery “header” image. The gallery div is configured for 50×50 square thumbnails, you’ll need to play with CSS to get it to fit your size thumbnails. This also will not work for fluid layouts:
<?php
/**
[comments]
**/
?>
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
<div id="gallery_<?php echo $gallery->ID ?>" class="galleryouter">
<?php $filename = $_SERVER{'/path/to/public_html/'}."path/to/headerdir/".$gallery->ID."-headerthmb.jpg";
if (file_exists($filename)) { ?>
<div id="gallery_<?php echo $gallery->ID ?>_header" class="gallery_header">
<a href="siteurl/path/to/hdr/dir/<?php echo $gallery->ID ?>-header.jpg">
<img src="siteurl/path/to/hdr/dir/<?php echo $gallery->ID ?>-headerthmb.jpg" title="" alt="" />
</a>
</div>
<?php } else { ?>
<div id="gallery_<?php echo $gallery->ID ?>_header" class="gallery_header"><!-- No Gallery Header Image Found --></div>
<?php }
?>
<!-- end Gallery Header -->
<div class="galleryimages"></p>
<div id="gallery_<?php echo $gallery->ID ?>_inner" class="galleryimagesinner">
<?php foreach ($images as $image) : ?>
<div class="gallery_small_thumb">
<a>imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?>>
<img title="<?php echo $image->alttext ?>" alt="" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?>class="gallery_thumbnail" /></a></div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
CSS:
.gallery_small_thumb img {
border:medium none !important;
margin:0 auto !important;
padding:0 !important;
}
.galleryouter {
float:left;
margin:4px 10px 0 0;
width:250px;
}
.gallery_header img {
border:medium none !important;
margin:0 !important;
padding:0 !important;
}
.galleryimages {
background:#E7EBEE none repeat scroll 0 0;
overflow:auto;
padding-top:10px;
}
.gallery_small_thumb {
float:left;
height:50px;
margin:0 10px 10px 0;
width:50px;
}
.galleryimagesinner {
clear:both;
padding:0 0 0 10px;
}
Should be a good starting point for anyone looking to center images in a gallery, it’s a good solution to a table setup (ew tables). If anyone has a better solution please post it!
Note: The Post code thing went whacky, you might have to pick out some random markup…
About your problem with centering both portrait and landscape, you could try modifying my code to wrap the images inside a “<p>”, like this:
<div class="gallery_small_thumb">
<p class="galleryimage"><a>imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?>>
<img title="<?php echo $image->alttext ?>" alt="" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?>class="gallery_thumbnail" /></a></p></div>
and then for your CSS try this:
.galleryimage {
text-align:center;
margin: 0px auto;
padding:0px;
background: none;
}
It might need some finagling, but that should work.
As far as the lightbox/thickbox error goes, try playing with the thickbox settings, that seems like another type of error. Maybe you’ve enabled a setting where it automatically inserts a “rel=” into every image’s tag. I’m using a custom shadowbox build only meant for images and I don’t have that problem on the latest build of NextGen Gallery.