User Select Slideshow Speeds - Drop Down Menu cpg 1.4.x - Mod User Select Slideshow Speeds - Drop Down Menu cpg 1.4.x - Mod
 

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

Main Menu

User Select Slideshow Speeds - Drop Down Menu cpg 1.4.x - Mod

Started by wirewolf, June 10, 2006, 09:27:56 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

wirewolf

Installed Coppermine about a week ago (just upgraded to cpg 1.4 8 ). After much editing and checking out of the scripts, I'm almost ready to put cpg into production mode. The one thing I noticed was there was no choice for users for the speed of the slide show. After some editing I came up with a relatively simple mod. Feel free to try it out and if the moderators find it useful, please move it to the appropiate section.

User Select Slideshow Speeds - Drop Down Menu
mod by wirewolf - http://academyphotos.net/
See example - http://academyphotos.net/photogallery/displayimage-425-Ships'-Compass-Binnacle.html

Used in Coppermine Version cpg 1.4.8 (also worked in cpg 1.4.7) Classic Theme (should work in others)
Works in IE and Firefox (not tested with Opera)

The javascript code for the drop down is borrowed from a mod by Dr Preacox:
http://forum.coppermine-gallery.net/index.php?topic=32108.0

As always, BACKUP, BACKUP, BACKUP! your existing file just in case.

File to edit (1):
In themes/<YOUR_THEME>/theme.php:

Find in - // HTML template for the image navigation bar - (approx line 612):
<td align="center" valign="middle" class="navmenu" width="48px">
<a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}">
<img src="{LOCATION}images/slideshow.gif" border="0px" align="middle" alt="{SLIDESHOW_TITLE}" /></a>
</td>


Replace with:
<td align="center" valign="middle" class="navmenu" nowrap="nowrap">
  <script language="javascript" type="text/javascript">
function Go() {
if (document.slide.slidespeed[document.slide.slidespeed.selectedIndex].value != "") {
location = document.slide.slidespeed[document.slide.slidespeed.selectedIndex].value
}
}//-->
</script>
<form name="slide" style="margin: 0">
    <select name="slidespeed">
    <option value=''>Slideshow Speed</option>
    <option value="{SLIDESHOW_TGT}">-&gt; 3 Seconds</option>
    <option value="{SLIDESHOW_TGT2}">-&gt; 5 Seconds</option>
    <option value="{SLIDESHOW_TGT3}">-&gt; 7 Seconds</option>
    <option value="{SLIDESHOW_TGT4}">-&gt; 10 Seconds</option></select>
<input title="Users with slower connections may want to select 7 to 10 second speeds" class="button" onclick="Go()" type="button" value="Go!" />
</form>
</td>

--------------------------
Find in - function theme_html_img_nav_menu() - (approx line 2142):
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=".$CONFIG['slideshow_interval'];

Replace with (Note: I choose to hard code in the timing values. I think this range will suit most users (3 seconds to 10 seconds).
Of course you can select whatever times you wish. If you want to add more choices, be sure to edit all of the appropiate lines.
Example - $slideshow_tgt5 in three places, etc):$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=3000";
$slideshow_tgt2 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=5000";
$slideshow_tgt3 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=7000";
$slideshow_tgt4 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=10000";


Optional replace - (Note: you can leave in the one line if you want - slideshow=".$CONFIG['slideshow_interval']
- this can be your base speed selection as in the - Slideshow interval in milliseconds (1 second = 1000 milliseconds)
under the Admin panel for "Image view":
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=".$CONFIG['slideshow_interval'];
$slideshow_tgt2 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=5000";
$slideshow_tgt3 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=7000";
$slideshow_tgt4 = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&amp;pid=$pid&amp;slideshow=10000";

--------------------------
Find in - $params = array('{THUMB_TGT}' => $thumb_tgt, - (approx line 2155):'{SLIDESHOW_TGT}' => $slideshow_tgt,

Replace with:
'{SLIDESHOW_TGT}' => $slideshow_tgt,
'{SLIDESHOW_TGT2}' => $slideshow_tgt2,
'{SLIDESHOW_TGT3}' => $slideshow_tgt3,
'{SLIDESHOW_TGT4}' => $slideshow_tgt4,


Note: If you visit the example page you'll see that I am running the "sef_urls" (mod rewrite) and the "minicms" (by donnoman) plugins.
This "Drop Down Menu" edit works with or without these plugins (at least it did for me).

Hope you find this mod useful,
John

meisdug

Great mod, thanks John.  I just added this mod to my gallery and it works great (cpg 1.4.18).  I wanted to mention, though, that the code to edit has moved to include/themes.inc.php instead of themes/<YOUR_THEME>/theme.php.  It took me a few minutes to figure that out and find it and I just wanted to pass that along for the next guy.

--Doug