Greetings,
When a user clicks on a thumbnail and the image is displayed in displayimage.php, I would like the navigation arrows (previous & next file) to be positioned to the left and right of that image.
Can anyone point me in the right direction?
Thanks again !
you should edit your theme.php
look for $template_img_navbar variable and chage it the way you want
if you don't have $template_img_navbar variable under your theme.php copy it from themes/sample/theme.php
Quote from: bmossavari on July 27, 2006, 10:54:54 PM
you should edit your theme.php
look for $template_img_navbar variable and chage it the way you want
if you don't have $template_img_navbar variable under your theme.php copy it from themes/sample/theme.php
Thanks for the reply. But I didn't have this code in my theme.php.
Then do as suggested:
Quote from: bmossavari on July 27, 2006, 10:54:54 PM
if you don't have $template_img_navbar variable under your theme.php copy it from themes/sample/theme.php
Quote from: GauGau on July 28, 2006, 08:48:43 AM
Then do as suggested:
I copied the code from sample/theme.php, added the <a> tags to the left and right of {image}, and this is what I got:
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.rodsquad.net%2Fpostimages%2Fscreen.jpg&hash=3c5557803cdf3371235c032509dfe8dd5b951cc6)
Here's the code I used:
// HTML template for intermediate image display
$template_display_media = <<<EOT
<tr>
<td align="center" class="display_media" nowrap="nowrap">
<table cellspacing="2px" cellpadding="0px" class="imageborder">
<tr> <td align="center" valign="middle" class="navmenu" width="48px">
<a href="{PREV_TGT}" class="navmenu_pic" title="{PREV_TITLE}"><img src="{LOCATION}images/prev.gif" border="0px" align="middle" alt="{PREV_TITLE}" /></a>
</td>
<td align="center">
{IMAGE}
</td>
<td align="center" valign="middle" class="navmenu" width="48px">
<a href="{NEXT_TGT}" class="navmenu_pic" title="{NEXT_TITLE}"><img src="{LOCATION}images/next.gif" border="0px" align="middle" alt="{NEXT_TITLE}" /></a>
</td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" cellspacing="2px" cellpadding="0px" class="tableb">
<tr>
<td align="center">
{ADMIN_MENU}
</td>
</tr>
</table>
<!-- BEGIN img_desc -->
<table cellpadding="0px" cellspacing="0px" class="tableb" width="100%">
<!-- BEGIN title -->
<tr>
<td class="tableb"><center><b>
{TITLE}
</b></center></td>
</tr>
<!-- END title -->
<!-- BEGIN caption -->
<tr>
<td class="tableb"><center>
{CAPTION}
</center></td>
</tr>
<!-- END caption -->
</table>
<!-- END img_desc -->
</td>
</tr>
EOT;
Still didn't work. If it's not possible, no big deal. Thanks anyways.
you should add these two function to your theme:
function theme_html_picture()
{
global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
global $album, $comment_date_fmt, $template_display_media;
global $lang_display_image_php, $lang_picinfo;
global $prev_tgt, $prev_title, $next_tgt, $next_title; //Moded by bmossavari for changing navigation arrow positions
$pid = $CURRENT_PIC_DATA['pid'];
$pic_title = '';
if (!isset($USER['liv']) || !is_array($USER['liv'])) {
$USER['liv'] = array();
}
// Add 1 to hit counter
if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
add_hit($pid);
if (count($USER['liv']) > 4) array_shift($USER['liv']);
array_push($USER['liv'], $pid);
}
if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
$condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
$condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
$condition = true;
}else{
$condition = false;
}
if ($CURRENT_PIC_DATA['title'] != '') {
$pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
}
if ($CURRENT_PIC_DATA['caption'] != '') {
$pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
}
if ($CURRENT_PIC_DATA['keywords'] != '') {
$pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
}
if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'img_desc');
} else {
if (!$CURRENT_PIC_DATA['title']) {
template_extract_block($template_display_media, 'title');
}
if (!$CURRENT_PIC_DATA['caption']) {
template_extract_block($template_display_media, 'caption');
}
}
$CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
} else {
$picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
}
$image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);
$pic_title = '';
$mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);
if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {
if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
$CURRENT_PIC_DATA['pwidth'] = 320; // Default width
// Set default height; if file is a movie
if ($mime_content['content']=='movie') {
$CURRENT_PIC_DATA['pheight'] = 240; // Default height
}
}
$ctrl_offset['mov']=15;
$ctrl_offset['wmv']=45;
$ctrl_offset['swf']=0;
$ctrl_offset['rm']=0;
$ctrl_offset_default=45;
$ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
$image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
}
if ($mime_content['content']=='image') {
if (isset($image_size['reduced'])) {
$winsizeX = $CURRENT_PIC_DATA['pwidth']+5; //the +'s are the mysterious FF and IE paddings
$winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
$pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
$pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
$pic_html .= "</a>\n";
} else {
$pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
}
} elseif ($mime_content['content']=='document') {
$pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
$pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
} else {
$autostart = ($CONFIG['media_autostart']) ? ('true'):('false');
$players['WMP'] = array('id' => 'MediaPlayer',
'clsid' => 'classid="" ',
'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
'mime' => 'type="application/x-mplayer2" ',
);
$players['RMP'] = array('id' => 'RealPlayer',
'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
'codebase' => '',
'mime' => 'type="audio/x-pn-realaudio-plugin" '
);
$players['QT'] = array('id' => 'QuickTime',
'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
'mime' => 'type="video/x-quicktime" '
);
$players['SWF'] = array('id' => 'SWFlash',
'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
'mime' => 'type="application/x-shockwave-flash" '
);
$players['UNK'] = array('id' => 'DefaultPlayer',
'clsid' => '',
'codebase' => '',
'mime' => ''
);
if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
$user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
} else {
$user_player = $mime_content['player'];
}
// There isn't a player selected or user wants client-side control
if (!$user_player) {
$user_player = 'UNK';
}
$player = $players[$user_player];
$pic_html = '<object id="'.$player['id'].'" '.$player['clsid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
$pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
$pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
$pic_html .= "</object><br />\n";
}
$CURRENT_PIC_DATA['html'] = $pic_html;
$CURRENT_PIC_DATA['header'] = '';
$CURRENT_PIC_DATA['footer'] = '';
$CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);
$params = array('{CELL_HEIGHT}' => '100',
'{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
'{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
'{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
'{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
'{PREV_TGT}' => $prev_tgt,//Moded by bmossavari for changing navigation arrow positions
'{PREV_TITLE}' => $prev_title,//Moded by bmossavari for changing navigation arrow positions
'{NEXT_TGT}' => $next_tgt,//Moded by bmossavari for changing navigation arrow positions
'{NEXT_TITLE}' => $next_title,//Moded by bmossavari for changing navigation arrow positions
'{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',//Moded by bmossavari for changing navigation arrow positions
'{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',//Moded by bmossavari for changing navigation arrow positions
'{LOCATION}' => $location,//Moded by bmossavari for changing navigation arrow positions
);
return template_eval($template_display_media, $params);
}
function theme_html_img_nav_menu()
{
global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR ; //$PHP_SELF,
global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;
global $prev_tgt, $prev_title, $next_tgt, $next_title; //Moded by bmossavari for changing navigation arrow positions
$cat_link = is_numeric($album) ? '' : '&cat=' . $cat;
$uid_link = is_numeric($_GET['uid']) ? '&uid=' . $_GET['uid'] : '';
$human_pos = $pos + 1;
$page = ceil(($pos + 1) / ($CONFIG['thumbrows'] * $CONFIG['thumbcols']));
$pid = $CURRENT_PIC_DATA['pid'];
$start = 0;
$start_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$start";
$start_title = $lang_img_nav_bar['go_album_start'];
$meta_nav .= "<link rel=\"start\" href=\"$start_tgt\" title=\"$start_title\" />
";
$end = $pic_count - 1;
$end_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$end";
$end_title = $lang_img_nav_bar['go_album_end'];
$meta_nav .= "<link rel=\"last\" href=\"$end_tgt\" title=\"$end_title\" />
";
if ($pos > 0) {
$prev = $pos - 1;
$prev_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$prev$uid_link";
$prev_title = $lang_img_nav_bar['prev_title'];
$meta_nav .= "<link rel=\"prev\" href=\"$prev_tgt\" title=\"$prev_title\" />
";
} else {
$prev_tgt = "javascript:;";
$prev_title = "";
}
if ($pos < ($pic_count -1)) {
$next = $pos + 1;
$next_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link&pos=$next$uid_link";
$next_title = $lang_img_nav_bar['next_title'];
$meta_nav .= "<link rel=\"next\" href=\"$next_tgt\" title=\"$next_title\"/>
";
} else {
$next_tgt = "javascript:;";
$next_title = "";
}
if (USER_CAN_SEND_ECARDS) {
$ecard_tgt = "ecard.php?album=$album$cat_link&pid=$pid&pos=$pos";
$ecard_title = $lang_img_nav_bar['ecard_title'];
} else {
template_extract_block($template_img_navbar, 'ecard_button'); // added to remove button if cannot send ecard
/*$ecard_tgt = "javascript:alert('" . addslashes($lang_img_nav_bar['ecard_disabled_msg']) . "');";
$ecard_title = $lang_img_nav_bar['ecard_disabled'];*/
}
//report to moderator buttons
if (($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS)) {
$report_tgt = "report_file.php?album=$album$cat_link&pid=$pid&pos=$pos";
} else { // remove button if report toggle is off
template_extract_block($template_img_navbar, 'report_file_button');
}
$thumb_tgt = "thumbnails.php?album=$album$cat_link&page=$page$uid_link";
$meta_nav .= "<link rel=\"up\" href=\"$thumb_tgt\" title=\"".$lang_img_nav_bar['thumb_title']."\"/>
";
$slideshow_tgt = "{$_SERVER['PHP_SELF']}?album=$album$cat_link$uid_link&pid=$pid&slideshow=".$CONFIG['slideshow_interval'];
$pic_pos = sprintf($lang_img_nav_bar['pic_pos'], $human_pos, $pic_count);
if (defined('THEME_HAS_NAVBAR_GRAPHICS')) {
$location= $THEME_DIR;
} else {
$location= '';
}
$params = array('{THUMB_TGT}' => $thumb_tgt,
'{THUMB_TITLE}' => $lang_img_nav_bar['thumb_title'],
'{PIC_INFO_TITLE}' => $lang_img_nav_bar['pic_info_title'],
'{SLIDESHOW_TGT}' => $slideshow_tgt,
'{SLIDESHOW_TITLE}' => $lang_img_nav_bar['slideshow_title'],
'{PIC_POS}' => $pic_pos,
'{ECARD_TGT}' => $ecard_tgt,
'{ECARD_TITLE}' => $ecard_title,
'{PREV_TGT}' => $prev_tgt,
'{PREV_TITLE}' => $prev_title,
'{NEXT_TGT}' => $next_tgt,
'{NEXT_TITLE}' => $next_title,
'{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',
'{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',
'{REPORT_TGT}' => $report_tgt,
'{REPORT_TITLE}' => $lang_img_nav_bar['report_title'],
'{LOCATION}' => $location,
);
return template_eval($template_img_navbar, $params);
}
Well, I got it to work perfectly with the functions provided above. But then I noticed when I started a slideshow, I got this:
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.rodsquad.net%2Fpostimages%2Fscreen2.jpg&hash=7e03931cb5b95a4f09733e9539e0632d260796f9)
So maybe it's time to just forget trying this .... :-\
put this function to your theme too:
function theme_slideshow()
{
global $CONFIG, $lang_display_image_php, $template_display_media;
global $prev_tgt, $prev_title, $next_tgt, $next_title; //Moded by bmossavari for changing navigation arrow positions
pageheader($lang_display_image_php['slideshow']);
include "include/slideshow.inc.php";
$start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>';
template_extract_block($template_display_media, 'img_desc', $start_slideshow);
$params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
'{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
'{ADMIN_MENU}' => '',
'{PREV_TGT}' => $prev_tgt,
'{PREV_TITLE}' => $prev_title,
'{NEXT_TGT}' => $next_tgt,
'{NEXT_TITLE}' => $next_title,
'{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',
'{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',
'{LOCATION}' => $location,
);
starttable();
echo template_eval($template_display_media, $params);
endtable();
starttable();
echo <<<EOT
<tr>
<td align="center" class="navmenu" style="white-space: nowrap;">
<a href="javascript:endSlideShow()" class="navmenu">{$lang_display_image_php['stop_slideshow']}</a>
</td>
</tr>
EOT;
endtable();
pagefooter();
}
this way you have those arrows correctly around the image if you don't want them tell me , you can remove them too
The sample pic taken during the slideshow shows that the slideshow JavaScript (and subsequently the M$-filters used by it) have frozen. Not related to your issues imo. Observe JavaScript errors in the status bar of the browser.
Quote from: GauGau on July 29, 2006, 07:43:45 AM
The sample pic taken during the slideshow shows that the slideshow JavaScript (and subsequently the M$-filters used by it) have frozen. Not related to your issues imo. Observe JavaScript errors in the status bar of the browser.
Thanks for the help so far. Actually, I'd like to have no arrows during the slideshow if that was possible.
And the slideshow didn't freeze up at all. I just happened to take the screenshot during the transition. ;)
okey try this new theme_slideshow() function instead the one on last post
function theme_slideshow() //Moded by bmossavari for changing navigation arrow positions
{
global $CONFIG, $lang_display_image_php, $template_display_media_slideshow;
global $prev_tgt, $prev_title, $next_tgt, $next_title; //Moded by bmossavari for changing navigation arrow positions
pageheader($lang_display_image_php['slideshow']);
include "include/slideshow.inc.php";
$start_slideshow = '<script language="JavaScript" type="text/JavaScript">runSlideShow()</script>';
template_extract_block($template_display_media_slideshow, 'img_desc', $start_slideshow);
$params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
'{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
'{ADMIN_MENU}' => '',
'{PREV_TGT}' => $prev_tgt,
'{PREV_TITLE}' => $prev_title,
'{NEXT_TGT}' => $next_tgt,
'{NEXT_TITLE}' => $next_title,
'{PREV_IMAGE}' => ($lang_text_dir=='ltr') ? 'prev' : 'next',
'{NEXT_IMAGE}' => ($lang_text_dir=='ltr') ? 'next' : 'prev',
'{LOCATION}' => $location,
);
starttable();
echo template_eval($template_display_media_slideshow, $params);
endtable();
starttable();
echo <<<EOT
<tr>
<td align="center" class="navmenu" style="white-space: nowrap;">
<a href="javascript:endSlideShow()" class="navmenu">{$lang_display_image_php['stop_slideshow']}</a>
</td>
</tr>
EOT;
endtable();
pagefooter();
}
and also add this new variable to your theme:
// HTML template for intermediate image display on Slideshow , added for changing navigation arrow position mode by b.mossavari
$template_display_media_slideshow = <<<EOT
<tr>
<td align="center" class="display_media" nowrap="nowrap">
<table cellspacing="2" cellpadding="0" class="imageborder">
<tr>
<td align="center">
{IMAGE}
</td>
</tr>
</table>
</td></tr>
<tr><td>
<table width="100%" cellspacing="2" cellpadding="0" class="tableb">
<tr>
<td align="center">
{ADMIN_MENU}
</td>
</tr>
</table>
<!-- BEGIN img_desc -->
<table cellpadding="0" cellspacing="0" class="tableb" width="100%">
<!-- BEGIN title -->
<tr>
<td class="tableb"><center><b>
{TITLE}
</b></center></td>
</tr>
<!-- END title -->
<!-- BEGIN caption -->
<tr>
<td class="tableb"><center>
{CAPTION}
</center></td>
</tr>
<!-- END caption -->
</table>
<!-- END img_desc -->
</td>
</tr>
EOT;
Quote from: bmossavari on July 29, 2006, 01:55:45 PM
okey try this new theme_slideshow() function instead the one on last post
Didn't work at first, but then I included all three functions that you provided, and now it works 100%.
I thank you very much !