This mod replaces the text links used in the details.html template with buttons. There are two ways to do it.
Quick And Dirty Method
1. Put the <img> tag in your language pack's main.php in place of the "next" image text. Be sure to put a backslash character in front of embedded double quote characters like this:
$lang['next_image'] = "<img src=\"{template_url}/images/next_image.gif\" border=\"0\">";
The drawback here is that if there is no next (or previous) image link, there will be no output and this could throw off your HTML tables. It also doesn't work with 4images installations using multi-language support.
Clean And Elegant Method
2. Put an HTML img tag and the next/previous links in your template details.html.
2.1 Create 4 buttons: image_prev.gif, image_prev_off.gif, image_next_off.gif, image_next.gif
2.1.1 Place these in your template's "images" directory if you're only supporting one language.
EXAMPLE:templates/default/images/next_off.gif
2.1.2 For multi-language support, create different language specific versions of the 4 buttons and place them in the appropriate templates/<your template set name/images_<language> directory.
EXAMPLE: If your 4images installation supports both English and Deutsch:
templates/default/images_deutsch/next_off.gif
templates/default/images_english/next_off.gif
2.2 Open details.php, find
// Get next and previous image
if (!empty($next_prev_cache[$next_image_id])) {
$next_image_name = htmlspecialchars($next_prev_cache[$next_image_id]['image_name']);
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_image_file = ICON_PATH."/404.gif";
}
else {
$next_image_file = get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$next_image_id]['image_media_file']).".gif";
}
else {
$next_thumb_file = get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
}
else {
$next_image_name = REPLACE_EMPTY;
$next_image_url = REPLACE_EMPTY;
$next_image_file = REPLACE_EMPTY;
$next_thumb_file = REPLACE_EMPTY;
}
if (!empty($next_prev_cache[$prev_image_id])) {
$prev_image_name = htmlspecialchars($next_prev_cache[$prev_image_id]['image_name']);
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_image_file = ICON_PATH."/404.gif";
}
else {
$prev_image_file = get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
}
else {
$prev_thumb_file = get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
}
else {
$prev_image_name = REPLACE_EMPTY;
$prev_image_url = REPLACE_EMPTY;
$prev_image_file = REPLACE_EMPTY;
$prev_thumb_file = REPLACE_EMPTY;
}
$site_template->register_vars(array(
"next_image_id" => $next_image_id,
"next_image_name" => $next_image_name,
"next_image_url" => $next_image_url,
"next_image_file" => $next_image_file,
"next_thumb_file" => $next_thumb_file,
"prev_image_id" => $prev_image_id,
"prev_image_name" => $prev_image_name,
"prev_image_url" => $prev_image_url,
"prev_image_file" => $prev_image_file,
"prev_thumb_file" => $prev_thumb_file
));
unset($next_prev_cache);
Replace with:
// Get next and previous image
if (!empty($next_prev_cache[$next_image_id])) {
$next_image_name = htmlspecialchars($next_prev_cache[$next_image_id]['image_name']);
$next_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_image_file = ICON_PATH."/404.gif";
}
else {
$next_image_file = get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 0)) {
$next_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$next_image_id]['image_media_file']).".gif";
}
else {
$next_thumb_file = get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$next_image_id]['cat_id'], 0, 1);
}
$next_button_file = get_gallery_image("image_next.gif"); // MOD: Next-Previous Buttons
}
else {
$next_image_name = REPLACE_EMPTY;
$next_image_url = REPLACE_EMPTY;
$next_image_file = REPLACE_EMPTY;
$next_thumb_file = REPLACE_EMPTY;
$next_button_file = get_gallery_image("image_next_off.gif"); // MOD: Next-Previous Buttons
}
if (!empty($next_prev_cache[$prev_image_id])) {
$prev_image_name = htmlspecialchars($next_prev_cache[$prev_image_id]['image_name']);
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&mode=".$mode : ""));
if (!get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_image_file = ICON_PATH."/404.gif";
}
else {
$prev_image_file = get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
if (!get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 0)) {
$prev_thumb_file = ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
}
else {
$prev_thumb_file = get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb", $next_prev_cache[$prev_image_id]['cat_id'], 0, 1);
}
$prev_button_file = get_gallery_image("image_prev.gif"); // MOD: Next-Previous Buttons
}
else {
$prev_image_name = REPLACE_EMPTY;
$prev_image_url = REPLACE_EMPTY;
$prev_image_file = REPLACE_EMPTY;
$prev_thumb_file = REPLACE_EMPTY;
$prev_button_file = get_gallery_image("image_prev_off.gif"); // MOD: Next-Previous Buttons
}
$site_template->register_vars(array(
"next_image_id" => $next_image_id,
"next_image_name" => $next_image_name,
"next_image_url" => $next_image_url,
"next_image_file" => $next_image_file,
"next_thumb_file" => $next_thumb_file,
"prev_image_id" => $prev_image_id,
"prev_image_name" => $prev_image_name,
"prev_image_url" => $prev_image_url,
"prev_image_file" => $prev_image_file,
"prev_thumb_file" => $prev_thumb_file, // MOD: Next-Previous Buttons
"next_button" => $next_button_file, // MOD: Next-Previous Buttons
"prev_button" => $prev_button_file // MOD: Next-Previous Buttons
));
unset($next_prev_cache);
2.3 Open details.html, find this:
{if next_image_name}
{lang_next_image}<br />
<b><a href="{next_image_url}">{next_image_name}</a></b>
{endif next_image_name}
Replace with:
{if next_image_url}<a href="{next_image_url}">{endif next_image_url}
<img src="{next_button}" border="0" alt="{next_image_name}">
{if next_image_url}</a>{endif next_image_url}
2.4 Do the same for the previous image link.
The php code will output either an "off" button if there is no next image or an "on" button if there is. The button will only be clickable if it is the "on" button.
Revisions:
* Added multi-language support by calling get_gallery_image()