I'm working on modifying the code myself, so if no one else has a solution, I'll post mine. I couldn't use v@no's original code because I use jquery, and it breaks his code. With the layout of my site, it makes sense to have a favorites/lightbox button under the thumbnails. I built a screensaver mod(to replace KurtW's old one) and I want to be able to quickly add images to the favorites for use as a screensaver.
*EDIT*
Okay, I got it on my own. Here's what I did.
lightboxaction.php - same as yours above
<?php
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$error = 0;
if (isset($HTTP_GET_VARS['id']) || isset($HTTP_POST_VARS['id']))
{
$id = (isset($HTTP_POST_VARS['id'])) ? substr(trim($HTTP_POST_VARS['id']), 3) : substr(trim($HTTP_GET_VARS['id']), 3);
}
else
{
$id = "";
}
if ($id)
{
if (check_lightbox($id))
{
$title = (remove_from_lightbox($id)) ? get_gallery_image("lightbox_no.gif") : get_gallery_image("lightbox_yes.gif");
}
else
{
$title = (add_to_lightbox($id)) ? get_gallery_image("lightbox_yes.gif") : get_gallery_image("lightbox_no.gif");
}
}
else
{
$error = 1;
}
if ($error)
{
die("Security violation");
}
echo $title;
?>
javascript in header
<script type="text/javascript">
$(document).ready(function() {
$('div.lightbox img').click(function() {
var elementId = '#'+$(this).attr('id');
$.get(
"lightboxaction.php",
{ id: $(this).attr('id') },
function(data) {
$(elementId).attr('src', data);
},
"text");
return false;
});
});
</script>
first line
$lightbox_button = "<div class=\"lightbox\"><a href=\"".$site_sess->url($lightbox_url)."\"><img id=\"img".$image_row['image_id']."\" src=\"".get_gallery_image("lightbox_yes.gif")."\" border=\"0\" alt=\"\" /></a></div>"; }
second line
$lightbox_button = "<div class=\"lightbox\"><a href=\"".$site_sess->url($lightbox_url)."\"><img id=\"img".$image_row['image_id']."\" src=\"".get_gallery_image("lightbox_no.gif")."\" border=\"0\" alt=\"\" /></a></div>";
Works in thumbnail_bit anywhere I want it to.