Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: removing first prev and last next navigation graphics in displayimage.php  (Read 22370 times)

0 Members and 1 Guest are viewing this topic.

rrwwxx

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 51

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.
cu,
rrwwxx
°¿°
« Last Edit: July 22, 2007, 02:40:32 am by Nibbler »
Logged

Nibbler

  • Guest

Thankyou for your contribution.

Scheduled for 1.5.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de

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?
Logged

rrwwxx

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 51

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

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimg262.imageshack.us%2Fimg262%2F4841%2Farrowactivewg0.jpg&hash=b529eee19c1c9fa296b147bc726f14776e687fb7)

you would want to replace them with something like this

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimg338.imageshack.us%2Fimg338%2F1831%2Finactivems9.jpg&hash=c937b476f2580466a377edb87ca81f1cf9d5071f)

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
°¿°
Logged

neil fitzgerald

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: removing first prev and last next navigation graphics in displayimage.php
« Reply #4 on: September 08, 2007, 11:27:16 am »

It works for me with CPG1.4.10 but not my CPG1.4.12 test site.
Maybe I've broken something. Interested if it works for others.
Thanks,
Neil.
Logged

neil fitzgerald

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: removing first prev and last next navigation graphics in displayimage.php
« Reply #5 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.
Logged

jesusarmy

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 34
Re: removing first prev and last next navigation graphics in displayimage.php
« Reply #6 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);
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 20 queries.