I was looking for a gallery plugin, and among those literally speaking hundreds of gallery extensions for the WordPress blogging software I found ANIga, coded by Michael Naab. Though there are a few unpretty startup errors upon installing and uncatched error-notices during image-processing (Michael, did you forget do set error_reporting to E_ALL?), I’m pleased with the functionality the plugin gives you.
After customizing my default-Template theme I updated the functions.php-file, so that the function “top()” resizes more than 3 images correctly, if you pass any parameter > 3 to the function.
PHP:
-
function top($numb) {
-
// print most viewed pictures
-
-
/**
-
* Each picture will be downsized by $spill pixels
-
*/
-
$spill = round(100/$numb);
-
-
global $wpdb, $aniga_lang;
-
$i = 1; ?>
-
<div class=“gallery_clear”>
-
<h2><?php echo $numb; ?> <?php echo $aniga_lang['most_viewed']; ?></h2>
-
<br />
-
-
<?php
-
$gal_req = “SELECT “.$wpdb->anigal_pic.“.pid, “.$wpdb->anigal_pic.“.path, “.$wpdb->anigal_pic.“.filename, “.$wpdb->anigal_pic.“.hits, “.$wpdb->anigal_alb.“.wp_id FROM $wpdb->anigal_pic, $wpdb->anigal_alb WHERE “.$wpdb->anigal_pic.“.alb_id = “.$wpdb->anigal_alb.“.alb_id “.$this->query(“AND.pic”).” ORDER BY “.$wpdb->anigal_pic.“.hits DESC LIMIT $numb”;
-
$gal_ret = $wpdb->get_results($gal _req);
-
-
if (!empty($gal_ret)){
-
-
/**
-
* modified the computing of the height-attribute for the image.
-
*/
-
foreach ($gal_ret as $toppic) { ?>
-
-
<a href=“<?php echo anigal_get_permalink($toppic->wp_id, $toppic->pid, ‘pid’); ?>” title=“<?php echo $toppic->hits; ?> hits”><img src=“<?php echo $toppic->path . ‘thumb_’ . $toppic->filename; ?>” border=“0″ class=“gallery_pic_border” height=“<?php echo (($numb-($i-1))*$spill); ?>px” align=“bottom” alt=“<?php echo $toppic->hits; ?> hits” /></a>
-
-
<?php
-
$i++;
-
}
-
} ?>