Welcome to ILAsoft.net
Menu 
Home
Tutorials
CODE
About
Resume
FAQ
Wallpapers
Skins
Guestbook
Links
Search

Links 
phpBB: Open Source PHP bulletin board
MovableType: best perl based weblog/journal software.
The ultimate knowledge base for flash developers.
GreyMatter: perl based weblog/journal software.
Adobe Photoshop Lightroom Killer Tips

Misc 
::CONTACT::
Questions
Private

::DONATE US::
Donate a few $$$ to keep ILAsoft running.

::LINK TO US::
Respect ILAsoft!

ILAsoft.net PHP Source Code :: TWG Summary  
By just modifying five files (a total of around 25 lines added), you will be able to have your TWG Gallery produce "summary" pages, where the users will be able to see multiple medium-sized pictures, without having to go into each picture every-time. A must for high-bandwidth users/sites.

This article assumes you are running an unmodified version of Tiny Web Gallery script version 1.6.3. If you are running a different version, line numbers and code might be different.
File Comparison done based on "Araxis Merge File Comparison Reports" by Araxis Merge.

As always, remember to do a full back-up of the system or at least backup all the files you modify:



1. index.php

 
350       includ e (dirname (__FILE__)  . "/inc/i mage.inc.p hp");   350       includ e (dirname (__FILE__)  . "/inc/i mage.inc.p hp");
351   } else if  ($top10) {   351   } else if  ($top10) {
352       print_ top_10($al bum_enc, $ top10_type );   352       print_ top_10($al bum_enc, $ top10_type );
353   } else if  ($ila_summ ary) {    
354       print_ thumbnails ($twg_albu m, $twg_of fset, $wer te, $index , $twg_fof fset);    
355   } else if  ($twg_albu m != false ) { // thu mbnailview  - or top  10 view   353   } else if  ($twg_albu m != false ) { // thu mbnailview  - or top  10 view
356       print_ thumbnails ($twg_albu m, $twg_of fset, $wer te, $index , $twg_fof fset);   354       print_ thumbnails ($twg_albu m, $twg_of fset, $wer te, $index , $twg_fof fset);
357   } else { / / main vie w!   355   } else { / / main vie w!
 

2. inc\topnavigation.inc.php

Bonus: Lines 211 to 221 allows for Sideshows to be started from galleries (as opposed to a specific image). This is not a requirement for the Summary so can easily be skipped altogether.
 
159                    $ima gelist = g et_image_l ist($twg_a lbum);   159                    $ima gelist = g et_image_l ist($twg_a lbum);
160                    $ski p_thumbnai l_page_dum my = true;  // dummys et for the  include!   160                    $ski p_thumbnai l_page_dum my = true;  // dummys et for the  include!
161                    incl ude dirnam e(__FILE__ ) . "/navp ath.inc.ph p";   161                    incl ude dirnam e(__FILE__ ) . "/navp ath.inc.ph p";
162                        
163                    if ( $imagelist ) {   162                    if ( $imagelist ) {
164                             $nr_im ages = cou nt($imagel ist);   163                             $nr_im ages = cou nt($imagel ist);
165                                 
166                             //ILAs oft GALLER Y SUMMARY    
167                             if($il a_summary)    
168                                      echo "Su mmary of "  . $nr_ima ges . "&nb sp;" . (($ nr_images  == 1) ? $l ang_pictur e : $lang_ pictures);    
169                             else    
170                                      echo $nr _images .  " " .  (($nr_ima ges == 1)  ? $lang_pi cture : $l ang_pictur es);   164                             echo $ nr_images  . " "  . (($nr_i mages == 1 ) ? $lang_ picture :  $lang_pict ures);
171                    } el se {   165                    } el se {
172                             // not  sure if I  want to d isplay tex t here ;)   166                             // not  sure if I  want to d isplay tex t here ;)
 
197                             printf ("<a href= '%s' onmou seout='MM_ swapImgRes tore()' on mouseover= \"MM_swapI mage('topt humb','',' %sbuttons/ menu_up_ov er.gif',1) \"><img sr c='%sbutto ns/menu_up .gif' alt= '%s' title ='%s' id=' topthumb'  height='24 ' /></a>",  $upper_le vel , $ins tall_dir,  $install_d ir, $lang_ overview,  $lang_over view);   191                             printf ("<a href= '%s' onmou seout='MM_ swapImgRes tore()' on mouseover= \"MM_swapI mage('topt humb','',' %sbuttons/ menu_up_ov er.gif',1) \"><img sr c='%sbutto ns/menu_up .gif' alt= '%s' title ='%s' id=' topthumb'  height='24 ' /></a>",  $upper_le vel , $ins tall_dir,  $install_d ir, $lang_ overview,  $lang_over view);
198                             printf ("<script  type='text /javascrip t'> functi on key_up( ) { locati on.href='% s'; } </sc ript>", $u pper_level js) ;   192                             printf ("<script  type='text /javascrip t'> functi on key_up( ) { locati on.href='% s'; } </sc ript>", $u pper_level js) ;
199                    }   193                    }
200      
201                        
202      
203                    //IL Asoft GALL ERY SUMMAR Y    
204                    if($ nr_images  > 0 && $il a_summary  == false)  {    
205                             echo " &nbsp;<a h ref='" . $ _SERVER['P HP_SELF']  . "?twg_al bum=" . $a lbum_enc .  "&amp;twg _summary'> <img src=' ".$install _dir."butt ons/menu_s um_on.gif'  alt='Summ ary' title ='Summary'  id='summa ry_start'  height='24 ' /></a>";    
206                    } el seif($ila_ summary)   {    
207                             echo " &nbsp;<a h ref='" . $ _SERVER['P HP_SELF']  . "?twg_al bum=" . $a lbum_enc .  "&amp;twg _offset=0' ><img src= '".$instal l_dir."but tons/menu_ sum_off.gi f' alt='Ex it Summary ' title='E xit Summar y' id='sum mary_end'  height='24 ' /></a>";    
208                    }    
209                    //// ////////// ////////// /    
210      
211                    //IL Asoft Gall ery SlideS how    
212                    if ( $show_slid eshow && $ nr_images  > 0) {    
213                             if ($t wg_slidesh ow) {    
214                                      // the s lidestop=t rue is onl y needed t o find thi s link wit h javascri pt and be  able to ex cange this    
215                                      // dynam ically ->  if a user  stop the s lidtwg_sho w we can j ump to the  actual tw g_shown pi cture !!    
216                                      printf(" &nbsp;&nbs p;<a id='s top_slides how' href= '%s?twg_al bum=%s&amp ;twg_show= %s%s'                            onmouseout ='MM_swapI mgRestore( )' onmouse over=\"MM_ swapImage( 'stop_slid eshow_img' ,'','%sbut tons/menu_ stop_over. gif',1)\"> <img src=' %sbuttons/ menu_stop. gif' alt=' %s' title= '%s' id='s top_slides how_img' h eight='24'  /></a>",  $_SERVER[' PHP_SELF'] , $album_e nc, $image _enc, $twg _standalon e, $instal l_dir, $in stall_dir,  $lang_sto p_slidesho w, $lang_s top_slides how);    
217                             } else  {    
218                                      printf(" &nbsp;&nbs p;<a id='s tart_slide show' href ='%s?twg_a lbum=%s&am p;twg_show =1%s&amp;t wg_slidesh ow=true%s'  onmouseou t='MM_swap ImgRestore ()' onmous eover=\"MM _swapImage ('slidesho w','','%sb uttons/men u_start_ov er.gif',1) \"><img sr c='%sbutto ns/menu_st art.gif' a lt='%s' ti tle='%s' i d='slidesh ow' height ='24' /></ a>", $_SER VER['PHP_S ELF'], $al bum_enc, $ image_enc,  $twg_stan dalone, $i nstall_dir , $install _dir, $lan g_start_sl ideshow, $ lang_start _slideshow );    
219                             }    
220                    }    
221                    //// ////////// ////////// /    
222      
223                    echo  "&nbsp;</ td>";   194                    echo  "&nbsp;</ td>";
224                    prin tf("<td cl ass='topna vright' al ign='right '>");   195                    prin tf("<td cl ass='topna vright' al ign='right '>");
225     196  
 
228                               echo  "<a oncli ck='twg_sh owSec(" .  $lang_heig ht_tags_to p . ")' id ='i_top_ta gs' target ='details'  href='" .  $install_ dir . "i_f rames/i_to p_tags.php ?twg_album =" . $albu m_enc . $t wg_standal one . "'>"  . $lang_m enu_top_ta gs . "</a> ";   199                               echo  "<a oncli ck='twg_sh owSec(" .  $lang_heig ht_tags_to p . ")' id ='i_top_ta gs' target ='details'  href='" .  $install_ dir . "i_f rames/i_to p_tags.php ?twg_album =" . $albu m_enc . $t wg_standal one . "'>"  . $lang_m enu_top_ta gs . "</a> ";
229                    }   200       }
230     201  
231                        
232      
233                    if ( $show_topx ) { // onl y twg_show  the top x  when the  view count  is enable d   202                    if ( $show_topx ) { // onl y twg_show  the top x  when the  view count  is enable d
234                      $h as_element _before =  print_spac er($has_el ement_befo re);   203                      $h as_element _before =  print_spac er($has_el ement_befo re);
235                             echo " <a href='"  . $_SERVE R['PHP_SEL F'] . "?tw g_album="  . $album_e nc . "&amp ;twg_top10 =" . $topx _default .  $twg_stan dalone . " '>" . spri ntf($lang_ topx, $num ber_top10)  . "</a>";   204                             echo " <a href='"  . $_SERVE R['PHP_SEL F'] . "?tw g_album="  . $album_e nc . "&amp ;twg_top10 =" . $topx _default .  $twg_stan dalone . " '>" . spri ntf($lang_ topx, $num ber_top10)  . "</a>";
 

3. inc\parserequest.inc.php

 
86   } else   86   } else
87           $t wg_slidesh ow = false ;   87           $t wg_slidesh ow = false ;
88     88  
89   if (isset( $_GET['twg _summary'] ) && $twg_ album) {    
90           $i la_summary  = true;    
91   } else    
92           $i la_summary  = false;    
93      
94   if (isset( $_GET['twg _top10']))  {   89   if (isset( $_GET['twg _top10']))  {
95           $t op10_type  = $_GET['t wg_top10'] ;   90           $t op10_type  = $_GET['t wg_top10'] ;
96           $t op10_type  = replaceI nput($top1 0_type);   91           $t op10_type  = replaceI nput($top1 0_type);
 

4. inc\navpath.inc.php

 
46           $a ctpath = " ";   46           $a ctpath = " ";
47           re set ($path );   47           re set ($path );
48           wh ile (list  ($key, $va l) = each  ($path)) {   48           wh ile (list  ($key, $va l) = each  ($path)) {
49                     if   ($nr_count   ==   $nr_act_co unt   &&   $skip_thum bnail_page _dummy   &&   !$ila_summ ary )   {   49                     if   ($nr_count   ==   $nr_act_co unt   &&   $skip_thum bnail_page _dummy
)   {
50                             $val =  remove_br (getDirect oryName($b asedir . " /" . $actp ath . $val , $val));   50                             $val =  remove_br (getDirect oryName($b asedir . " /" . $actp ath . $val , $val));
51                             echo $ val . " >  ";   51                             echo $ val . " >  ";
52                             if ($p rintRoot)  {   52                             if ($p rintRoot)  {
 

5. inc\index.inc.php

 
242   function p rint_thumb nails($twg _album, $t wg_offset,  $werte, $ index, $tw g_foffset)   242   function p rint_thumb nails($twg _album, $t wg_offset,  $werte, $ index, $tw g_foffset)
243   {   243   {
244           gl obal $thum bnails_x,  $thumbnail s_y, $cach edir, $kwe rte, $kind ex, $based ir;   244           gl obal $thum bnails_x,  $thumbnail s_y, $cach edir, $kwe rte, $kind ex, $based ir;
245           gl obal $exte nsion_thum b, $top10,  $privatel ogin;   245           gl obal $exte nsion_thum b, $top10,  $privatel ogin;
246           gl obal $ila_ summary,$e xtension_s mall,$smal l_pic_size ;    
247           gl obal $lang _thumb_for ward, $lan g_thumb_ba ck, $insta ll_dir, $u se_origina l_on_thumb spage;   246           gl obal $lang _thumb_for ward, $lan g_thumb_ba ck, $insta ll_dir, $u se_origina l_on_thumb spage;
248           gl obal $twg_ standalone , $twg_sta ndalonejs,  $double_e ncode_urls , $autodet ect_maximu m_thumbnai ls;   247           gl obal $twg_ standalone , $twg_sta ndalonejs,  $double_e ncode_urls , $autodet ect_maximu m_thumbnai ls;
249           gl obal $thum b_pic_size , $show_nu mber_of_co mments, $l ang_commen ts, $disab le_direct_ thumbs_acc ess;   248           gl obal $thum b_pic_size , $show_nu mber_of_co mments, $l ang_commen ts, $disab le_direct_ thumbs_acc ess;
 
291                             $space x += $left _htm_width ;   290                             $space x += $left _htm_width ;
292                    }   291                    }
293     292  
294                    if(! $ila_summa ry) {    
295                             $thumb nails_x =  floor(($_S ESSION["br owserx"] -  $spacex)  / ($thumb_ pic_size +  5));   293                    $thu mbnails_x  = floor(($ _SESSION[" browserx"]  - $spacex ) / ($thum b_pic_size  + 5));
296                             $thumb nails_y =  floor(($_S ESSION["br owsery"] -  50 - $off set_text)  / ($thumb_ pic_size +  5));   294                    $thu mbnails_y  = floor(($ _SESSION[" browsery"]  - 50 - $o ffset_text ) / ($thum b_pic_size  + 5));
297                    } el se {    
298                             $thumb nails_x =  floor(($_S ESSION["br owserx"] -  $spacex)  / ($small_ pic_size +  5));    
299                             $thumb nails_y =  floor(($_S ESSION["br owsery"] -  50 - $off set_text)  / ($small_ pic_size +  5));    
300                    }    
301           }   295           }
302     296  
303           if  ($show_su bdirs_firs t) {   297           if  ($show_su bdirs_firs t) {
 
312                    $thu mbnails_y  = ceil($to tal / $thu mbnails_x)  + $minus_ rows + 1;  // one sav ty   306                    $thu mbnails_y  = ceil($to tal / $thu mbnails_x)  + $minus_ rows + 1;  // one sav ty
313           }   307           }
314              308     
315           if ($ila_summ ary) {    
316                    $thu mbnails_y= 20;    
317           }    
318         
319     $alignme nt = "";   309     $alignme nt = "";
320     if ($sho w_caption_ on_thumbs)  {   310     if ($sho w_caption_ on_thumbs)  {
321       $align ment= " to p";   311       $align ment= " to p";
322     }   312     }
323           $l thumbnails  = $thumbn ails_x * ( $thumbnail s_y - $min us_rows) ;    
324           pr int_thumbn ail_page_l inks(count ($imagelis t), $lthum bnails, $a lbum_enc,  $twg_offse t, $werte,  $index, $ twg_foffse t);    
325     313  
326           if  ($imageli st[0] != " ") {   314           if  ($imageli st[0] != " ") {
327                    echo  "<table s ummary=''  class='thu mbnails' c ellpadding ='0' cells pacing='0' >\n";   315                    echo  "<table s ummary=''  class='thu mbnails' c ellpadding ='0' cells pacing='0' >\n";
 
335                                               $aktimage  = replace_ valid_url( $aktimage) ;   323                                               $aktimage  = replace_ valid_url( $aktimage) ;
336                                               $replaced_ album = st r_replace( "/", "_",  $twg_album );   324                                               $replaced_ album = st r_replace( "/", "_",  $twg_album );
337                                               $thumbimag e = urlenc ode($repla ced_album  . "_" . ur ldecode($a ktimage));   325                                               $thumbimag e = urlenc ode($repla ced_album  . "_" . ur ldecode($a ktimage));
338                                               if(!$ila_s ummary)    
339                                                       $t humb = "./ " . $cache dir . "/"  . $thumbim age . "."  . $extensi on_thumb;   326                                               $thumb = " ./" . $cac hedir . "/ " . $thumb image . ". " . $exten sion_thumb ;
340                                               else    
341                                                       $t humb = "./ " . $cache dir . "/"  . $thumbim age . "."  . $extensi on_small;    
342                                               $ccount =  getKomment arCount($i magelist[$ imageid],  $twg_album , $kwerte,  $kindex);   327                                               $ccount =  getKomment arCount($i magelist[$ imageid],  $twg_album , $kwerte,  $kindex);
343                                               if   (! $ila_summa ry   &&   (! file_exist s($thumb)   ||   $disable_d irect_thum bs_access) )   {   328                                               if   (!
file_exist s($thumb)   ||   $disable_d irect_thum bs_access)  
{
344                                                       $s rc_value =  $install_ dir . "ima ge.php?twg _album=" .  $album_en c . "&amp; twg_type=t humb&amp;t wg_show="  . $aktimag e;   329                                                       $s rc_value =  $install_ dir . "ima ge.php?twg _album=" .  $album_en c . "&amp; twg_type=t humb&amp;t wg_show="  . $aktimag e;
345                                                       if  ($show_cl ipped_imag es) {   330                                                       if  ($show_cl ipped_imag es) {
346                                                                $the ight = " h eight='" .  $thumb_pi c_size . " ' width='"  . $thumb_ pic_size .  "' ";   331                                                                $the ight = " h eight='" .  $thumb_pi c_size . " ' width='"  . $thumb_ pic_size .  "' ";
 
351                                                       if  ($double_ encode_url s) {   336                                                       if  ($double_ encode_url s) {
352                                                                $thu mbimage =  urlencode( $thumbimag e);   337                                                                $thu mbimage =  urlencode( $thumbimag e);
353                                                       }   338                                                       }
354                                                       if (!$ila_sum mary)    
355                                                                $src _value = " ./" . $cac hedir . "/ " . urlenc ode($thumb image) . " ." . $exte nsion_thum b;   339                                                       $s rc_value =  "./" . $c achedir .  "/" . urle ncode($thu mbimage) .  "." . $ex tension_th umb;
356                                                       el se   340                                                        if   ($show_cli pped_image s
)   {
357                                                                $src _value = " ./" . $cac hedir . "/ " . urlenc ode($thumb image) . " ." . $exte nsion_smal l;    
358                                                        if   ($show_cli pped_image s   &&   !$ila_summ ary )   {    
359                                                                $the ight = " h eight='" .  $thumb_pi c_size . " ' width='"  . $thumb_ pic_size .  "' ";   341                                                                $the ight = " h eight='" .  $thumb_pi c_size . " ' width='"  . $thumb_ pic_size .  "' ";
360                                                       }  else {   342                                                       }  else {
361                                                                $isi ze = getim agesize ($ thumb);   343                                                                $isi ze = getim agesize ($ thumb);