ANIga - pimping my gallery

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:

  1. function top($numb) {

  2.         // print most viewed pictures

  3.      

  4.     /**

  5.      * Each picture will be downsized by $spill pixels

  6.      */

  7.     $spill = round(100/$numb);

  8.      

  9.         global $wpdb, $aniga_lang;

  10.         $i = 1; ?>

  11.         <div class=“gallery_clear”>

  12.         <h2><?php echo $numb; ?> <?php echo $aniga_lang[‘most_viewed’]; ?></h2>

  13.         <br />

  14.        

  15.         <?php

  16.         $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”;

  17.         $gal_ret = $wpdb->get_results($gal _req);

  18.        

  19.         if (!empty($gal_ret)){

  20.            

  21.              /**

  22.               * modified the computing of the height-attribute for the image.

  23.               */

  24.              foreach ($gal_ret as $toppic) { ?>

  25.               

  26.                 <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> 

  27.                

  28.             <?php

  29.             $i++;

  30.             }

  31.         } ?>

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)