SLIDESHOW V2.2 for LIGHTBOX/ALBUMThe latest version of the Slideshow Mod also works for registered users Lightbox/Album now.WARNING: This will not work with the lightbox for Guests Mod found here
http://www.4homepages.de/forum/viewtopic.php?t=4826Simply follow the steps in my first post ...
Replace step 1 slideshow.php code with this code
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: slideshow.php *
* Copyright: *
* Email: *
* Web: *
* Scriptversion: 1.7 *
* *
* *
*************************************************************************/
$templates_used = 'slideshow';
$main_template = 'slideshow';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('MEDIA_DIR', 'data/media');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
//-----------------------------------------------------
// Configrable variables ------------------------------
$max_height = "651"; // any images with a greater height will not be included in slide show
$max_width = "651"; // any images with a greater width will not be included in slide show
//-----------------------------------------------------
if ($action == "slideshow") {
if (!$cat_id || !isset($cat_cache[$cat_id]) || !check_permission("auth_viewcat", $cat_id)) {
header("Location: ".$site_sess->url(ROOT_PATH."index.php", "&"));
exit;
}
if ($cat_id && isset($cat_cache[$cat_id])) {
$txt_clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
}
if ($action == "slideshowlightbox") {
// $txt_clickstream = $lang['lightbox'];
$txt_clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php")."\" class=\"clickstream\">".$lang['lightbox']."</a>";
}
$msg = "";
//-----------------------------------------------------
//--- New Slide Show ----------------------------------
//-----------------------------------------------------
$main_template = 'slideshow';
$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image($cat_id);
$additional_sql = "";
$countit = 0;
$file_array = "theimage[0]=[' ','";
$additional_sql = "";
$image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
if ($action == "slideshow"){
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = $cat_id AND c.cat_id = i.cat_id
ORDER BY i.image_name" ;
}
else {
if (!empty($user_info['lightbox_image_ids'])) {
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")
ORDER BY i.image_name" ;
}}
if ($sql == ""){
$num_rows = "";}
else {
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
}
if (!$num_rows) {
$msg = "<div align=\"center\"> Sorry but there are no suitable images available for a slideshow. <br>Please try another category</div>";
}
else {
while ($image_row = $site_db->fetch_array($result))
{
if (!is_remote($image_row['image_media_file'])) {
$image_info = @getimagesize((MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file']));
$width = $image_info[0];
$height = $image_info[1];
}
$slideshow_id = MEDIA_PATH."/".$image_row['cat_id']."/";
if ($width >= $max_width) continue;
if ($height >= $max_height) continue;
if (stristr($image_row['image_media_file'],".jpg") || stristr($image_row['image_media_file'],".jpeg") || stristr($image_row['image_media_file'],".bmp") || stristr($image_row['image_media_file'],".gif")){
$countit = $countit + 1;
if (stristr($image_row['image_media_file'],'http'))
{
$file_array = $file_array."".$image_row['image_media_file']. "','./details.php?image_id=".$image_row['image_id']. " ']; theimage[".$countit."]=[' ','";
}
else
{
$file_array = $file_array."".$slideshow_id."".$image_row['image_media_file']. "','./details.php?image_id=".$image_row['image_id']. " ']; theimage[".$countit."]=[' ','";
}
}
}
$file_array = substr("$file_array", 0, -19);
if (!$countit) {
$msg = "<div align=\"center\"> Sorry but there are no suitable images available for a slideshow. <br>Please try another category</div>";
}
}
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$txt_clickstream."</span>";
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"file_array" => $file_array,
"slideshow_id" => $slideshow_id,
"random_cat_image" => $random_cat_image,
"msg" => $msg,
"countit" => $countit,
"clickstream" => $clickstream,
"lang_control_panel" => $lang['control_panel']
));
unset($random_cat_image);
unset($file_array);
unset ($countit);
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
Make a copy of your lightbox.php file (just in case)
Edit lightbox.php
Search for
if (!$num_rows) {
$thumbnails = "";
$msg .= ($msg != "") ? "<p>".$lang['lightbox_no_images'] : $lang['lightbox_no_images'];
Replace with
if (!$num_rows) {
$thumbnails = "";
$msg .= ($msg != "") ? "<p>".$lang['lightbox_no_images'] : $lang['lightbox_no_images'];
// added for slideshow mod
$slideshow_button = " <img src=\"".get_gallery_image("slideshow_off.gif")."\" border=\"0\" alt=\"".$lang['alt_slideshow_off']."\" />";
// -----------------------
Search for
$thumbnails .= "</table>\n";
Replace with
$thumbnails .= "</table>\n";
// added for slideshow mod
$slideshow_url = $site_sess->url(ROOT_PATH."slideshow.php?action=slideshowlightbox");
$slideshow_button = " <a href=\"".$slideshow_url."\"><img src=\"".get_gallery_image("slideshow.gif")."\" border=\"0\" alt=\"".$lang['alt_slideshow']."\" /></a>";
// added for slideshow mod
Search for
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream,
"lang_lightbox" => $lang['lightbox'],
"lang_delete_lightbox" => $lang['delete_lightbox'],
"url_delete_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php?action=clearlightbox"),
"lang_delete_lightbox_confirm" => $lang['delete_lightbox_confirm'],
"lang_lightbox_lastaction" => $lang['lighbox_lastaction'],
"download_button" => $download_button
Replace with
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream,
"lang_lightbox" => $lang['lightbox'],
"lang_delete_lightbox" => $lang['delete_lightbox'],
"url_delete_lightbox" => $site_sess->url(ROOT_PATH."lightbox.php?action=clearlightbox"),
"lang_delete_lightbox_confirm" => $lang['delete_lightbox_confirm'],
"lang_lightbox_lastaction" => $lang['lighbox_lastaction'],
"slideshow_button" => $slideshow_button, // added for slideshow mod
"download_button" => $download_button
Make a copy of your template lightbox.html
edit your lightbox.html and add
{slideshow_button}
Where you want the slideshow button to appear.
That's it. Now your registered members can enjoy viewing their favorite images using the slide show.