forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Menu/Navigation => Topic started by: rrwwxx on July 22, 2007, 02:26:20 am

Title: removing first prev and last next navigation graphics in displayimage.php
Post by: rrwwxx on July 22, 2007, 02:26:20 am
I found myself this little workaround to remove the navigation graphics in the nav bar when there is the first and the last image in an album to display. It was a little irritating for me to have these arrows displayed when there was only one photo in the album for instance.

I know it is not the most elegant code but I am happy that it works like it should. I've read some comments in the include libraries on future intensions to improve that anyway, but this is my quick and dirty solution to it.

In displayimage.php find the lines

Code: [Select]
   
    CPGPluginAPI::filter('post_breadcrumb',null);
    theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip);

and replace them with the code below.

Code: [Select]
   
     CPGPluginAPI::filter('post_breadcrumb',null);
     $vgl='href="javascript:;" class="navmenu_pic" title=""><img src="images/next.gif"';
     $pos=strpos($nav_menu, $vgl);
     if ($pos === FALSE) {} else {
       $nav_menu=substr($nav_menu,0,$pos). str_replace('next.gif','clearpixel.gif',$vgl) . substr($nav_menu,$pos+strlen($vgl));
     }
     $vgl=str_replace('next.gif','prev.gif',$vgl);
     $pos=strpos($nav_menu, $vgl);
     if ($pos === FALSE) {} else {
       $nav_menu=substr($nav_menu,0,$pos).  str_replace('prev.gif','clearpixel.gif',$vgl). substr($nav_menu,$pos+strlen($vgl));
     }
     theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip);

You need to put a transparent 1x1 pixel graphics named clearpixel.gif into your /images directory. You can take the one attached if you like.

See the example of this improvement here (http://www.hair-factory10.de/xg/displayimage.php?album=23&pos=0).
cu,
rrwwxx
°¿°
Title: Re: removing first prev and last next navigation graphics in displayimage.php
Post by: Nibbler on July 22, 2007, 02:36:07 am
Thankyou for your contribution.

Scheduled for 1.5.
Title: Re: removing first prev and last next navigation graphics in displayimage.php
Post by: Joachim Müller on July 23, 2007, 08:06:37 am
You need to put a transparent 1x1 pixel graphics named clearpixel.gif into your /images directory. You can take the one attached if you like.
Why not use blank.gif that already resides in the images folder?
Title: Re: removing first prev and last next navigation graphics in displayimage.php
Post by: rrwwxx on July 23, 2007, 02:21:03 pm
Quote
Why not use blank.gif that already resides in the images folder?
You're right of course. I had a look for such a graphics when sorting the images directory by size and didn't see it. In fact it would be smarter to replace those arrow graphics with similar looking buttons that have an 'inactive' design.

For example, if these are your ordinary buttons to browse to previous and next images

(http://img262.imageshack.us/img262/4841/arrowactivewg0.jpg)

you would want to replace them with something like this

(http://img338.imageshack.us/img338/1831/inactivems9.jpg)

This would require additional photo editing work on the buttons, though. Name then nextinactive.gif and previnactive.gif:

The code would need to take those images instead of clearpixel.gif (or your proposed blank.gif) you could use these new buttons.
Code: [Select]
     CPGPluginAPI::filter('post_breadcrumb',null);
     $vgl='href="javascript:;" class="navmenu_pic" title=""><img src="images/next.gif"';
     $pos=strpos($nav_menu, $vgl);
     if ($pos === FALSE) {} else {
       $nav_menu=substr($nav_menu,0,$pos). str_replace('next.gif','nextinactive.gif',$vgl) . substr($nav_menu,$pos+strlen($vgl));
     }
     $vgl=str_replace('next.gif','prev.gif',$vgl);
     $pos=strpos($nav_menu, $vgl);
     if ($pos === FALSE) {} else {
       $nav_menu=substr($nav_menu,0,$pos).  str_replace('prev.gif','previnactive.gif',$vgl). substr($nav_menu,$pos+strlen($vgl));
     }
     theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip);
cu,
rrwwxx
°¿°
Title: Re: removing first prev and last next navigation graphics in displayimage.php
Post by: neil fitzgerald on September 08, 2007, 11:27:16 am
It works for me with CPG1.4.10 but not my CPG1.4.12 test site (http://neilfitzgeraldphoto.com/gallery/displayimage.php?album=46&pos=0).
Maybe I've broken something. Interested if it works for others.
Thanks,
Neil.
Title: Re: removing first prev and last next navigation graphics in displayimage.php
Post by: neil fitzgerald on September 08, 2007, 11:53:35 am
Sorry, it seems to be my custom theme that has broke it. Not sure what, but it is my problem.
Title: Re: removing first prev and last next navigation graphics in displayimage.php
Post by: jesusarmy on December 11, 2007, 04:06:39 pm
If the theme uses its own navbar graphics, this mod is broken.
However, it just needs one line of code to be added to the mod, and one changed, in order to fix it. Plus, of course, the image files 'nextinactive.gif' and 'previnactive.gif' need to be uploaded to the theme's image directory.

Changing the same section of displayimage.php:
Code: [Select]
     CPGPluginAPI::filter('post_breadcrumb',null);
     if (defined('THEME_HAS_NAVBAR_GRAPHICS')) { $location= $THEME_DIR; } else { $location= '';}
     $vgl='href="javascript:;" class="navmenu_pic" title=""><img src="'.$location.'images/next.gif"';
     $pos=strpos($nav_menu, $vgl);
     if ($pos === FALSE) {} else {
       $nav_menu=substr($nav_menu,0,$pos). str_replace('next.gif','nextinactive.gif',$vgl) . substr($nav_menu,$pos+strlen($vgl));
     }
     $vgl=str_replace('next.gif','prev.gif',$vgl);
     $pos=strpos($nav_menu, $vgl);
     if ($pos === FALSE) {} else {
     $nav_menu=substr($nav_menu,0,$pos).  str_replace('prev.gif','previnactive.gif',$vgl). substr($nav_menu,$pos+strlen($vgl));
     }
     theme_display_image($nav_menu, $picture, $votes, $pic_info, $comments, $film_strip);