LightBox JS for Fullsize Popup Image - Page 12 LightBox JS for Fullsize Popup Image - Page 12
 

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

LightBox JS for Fullsize Popup Image

Started by Gizmo, August 29, 2006, 04:06:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zenlunch

Thanks for looking into this SaWay, but i don't think the code from the lightbox site will display properly on my thumbnails page. Right now, you can see I have hyperlinks under each thumbnail using the [url] code (http://constantcraftsman.com/gallery/).  I need something that will work for the lightbox and the thumbnail page. I have a feeling this doesn't exist. I may have to sacrifice one or the other...unless someone can figure out a way to work around this. Thanks again for taking the time to help!

zenlunch

Sorry for the crazy link - Should read this way:

Right now, you can see I have hyperlinks under each thumbnail which I got by using the [ url ] code.

http://constantcraftsman.com/gallery/.

SaWey

A solution to that is:

in 'displayimage.php' at line 270 :

FIND:
$CURRENT_PIC_DATA = $pic_data[0];

AFTER ADD:
$CURRENT_PIC_DATA['title'] = html_entity_decode($CURRENT_PIC_DATA['title']);

do the same for line 281.

Then you can enter a url like '<a href="test.htm">LINK</a>'

zenlunch

You are awesome SaWay! Thanks so much for your help!

zenlunch

Might have spoken a bit too soon...

I got the lightbox to display the hyperlink, but after adding the two lines of code to displayimage.php, the thumbnail links are still displaying HTML code rather than a hyperlink.

Any ideas?

BTW, you're still awesome SaWay - wouldn't have gotten this far without your help!

zenlunch

In case it helps, here's an excerpt of the code I added SaWay's two lines of code to:

// Retrieve data for the current picture
if ($pos < 0 || $pid > 0) {
    $pid = ($pos < 0) ? -$pos : $pid;
    $result = cpg_db_query("SELECT aid from {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' $ALBUM_SET LIMIT 1");
    if (mysql_num_rows($result) == 0) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
    $row = mysql_fetch_array($result);
    $album = $row['aid'];
    $pic_data = get_pic_data($album, $pic_count, $album_name, -1, -1, false);
    for($pos = 0; $pic_data[$pos]['pid'] != $pid && $pos < $pic_count; $pos++);
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    $CURRENT_PIC_DATA = $pic_data[0];
    $CURRENT_PIC_DATA['title'] = html_entity_decode($CURRENT_PIC_DATA['title']);

} elseif (isset($_GET['pos'])) {
    $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    if ($pic_count == 0) {
        cpg_die(INFORMATION, $lang_errors['no_img_to_display'], __FILE__, __LINE__);
    } elseif (count($pic_data) == 0 && $pos >= $pic_count) {
        $pos = $pic_count - 1;
        $human_pos = $pos + 1;
        $pic_data = get_pic_data($album, $pic_count, $album_name, $pos, 1, false);
    }
    $CURRENT_PIC_DATA = $pic_data[0];
    $CURRENT_PIC_DATA['title'] = html_entity_decode($CURRENT_PIC_DATA['title']);
}

SaWey

did you enter just html code or did you convert it? Cause you shouldn't convert it anymore.

BTW, you need to make one more change,
in your theme.php file:
FIND:
$thumb_list[$i]['caption'] = bb_decode($row['caption_text']);

REPLACE WITH:
$thumb_list[$i]['caption'] = bb_decode(html_entity_decode($row['caption_text']));

if you can't find it in your theme.php, then you can look for it in your 'include/theme.inc.php'

zenlunch

Ok, thought I still needed to convert it. Did a search for the code you mentioned in both my theme.php and theme.inc.php files and the only thing close was this:

  $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']),
        );

There is no other reference to bb_decode in either file. Can I edit the CAPTION code instead?

SaWey

I'm sorry, I was wrong, it's in functions.inc.php. (at line 1707)

zenlunch

I know this is probably getting old, but things still aren't quite working. I was able to add the code to functions.php but you can see here: http://constantcraftsman.com/gallery/displayimage.php?album=lastup&cat=0&pos=0

The link for the lightbox is showing up next to the image - clicking on it opens the lightbox, but then there is no hyperlink at the bottom of the lightbox.

What do you think?

SaWey

Could be another thing I forgot to mention :)
in your theme.php
FIND
$pic_title = ($picture['title'] ? $picture['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1",$picture['filename']), "_", " "));

REPLACE WITH:
$pic_title = ($picture['title'] ? $picture['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1", htmlspecialchars($picture['filename'])), "_", " "));

Sorry for this...

zenlunch

Man, I feel like a total noob. I've searched through several files trying to find the code you mentioned and have had no luck. Searched themes.php, themes.inc.php, and a few others just in case. Not sure what to do.

Oh, and please don't apologize for anything, you're taking time to help me out, I'm the one that should be apologizing.

SaWey

how are you using the lightbox function? cause the line I mentioned is in the code for the lightbox link.
You could try look for the part where the lightbox-link is created and make sure the variable in the 'title="$this_is_the_var_you_are_looking_for"' parameter is surrounded by the 'htmlspecialchars' function.
you should replace the title param with something like this:
'title="' . 'htmlspecialchars' ($this_is_the_var_you_are_looking_for) . '"'

If you can't figure it out, post the part where the lightbox link is created.

zenlunch

The code I grabbed was from Gizmo's post at the start of this thread.

I think this is the line of code I need to edit:

$pic_html = "<a href=\"$picfull_url\" rel=\"lightbox\" title=\"$pic_title\">";

Not sure how it would look though.

SaWey

just replace it with this:

$pic_html = "<a href=\"$picfull_url\" rel=\"lightbox\" title=\"" . htmlspecialchars($pic_title) . "\">";

zenlunch

Hallelujah! You did it, man. Everything works great. Thanks again for your help!

SaWey

No problem, just post a message if you have any other problems.

rrwwxx

Hi SaWey,

thanks for your great support in the forum concerning all matters referring to the Lightbox plugin. But I have to say it is a little difficult to find a final or improved version of the mod if you try to follow all posts in this thread. Perhaps I missed something to find a kind of final release to download?

I got it running in my second gallery that I nearly finished to develop here
http://galerie.toontown-click.de/index.php?cat=0&lang=english
but I would like to limit the number of images being possibly displayed in full screen.

I know something like this should work


################################################
//Set max number of images
$max = -1; //(-1 for all pics in album)
################################################


but it seems that my implemention doesn't have that code included. I can't find a variable called $max and I did take the code that I use from one of your posts:


//Second part of lightbox update

function lightbox_list($picId,$pic1_html) {
    global $lang_display_image_php, $CONFIG;

$i = 0;
$pid = $picId;
$pic_data = get_pic_data($_GET['album'], $pic_count, $album_name, -1, -1, false);
foreach ($pic_data as $picture) {
if($CONFIG['thumb_use']=='ht' && $picture['pheight'] > $CONFIG['picture_width'] ){
  $condition = true;
}elseif($CONFIG['thumb_use']=='wd' && $picture['pwidth'] > $CONFIG['picture_width']){
  $condition = true;
}elseif($CONFIG['thumb_use']=='any' && max($picture['pwidth'], $picture['pheight']) > $CONFIG['picture_width']){
  $condition = true;
}else{
$condition = false;
}
if (is_image($picture['filename'])) {
if ($CONFIG['make_intermediate'] && $condition ) {
$picture_url = get_pic_url($picture, 'normal');
} else {
$picture_url = get_pic_url($picture, 'normal');
}
$picture_url_fullsize = get_pic_url($picture, 'fullsize');
$pic_title = ($picture['title'] ? $picture['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1", htmlspecialchars($picture['filename'])), "_", " "));
if ($picture['pid'] == $pid) {
$picList .= "<a ".$pic1_html."href=\"$picture_url_fullsize\" rel=\"lightbox[list]\" title=\"$pic_title\">";
            $picList .= "<img src=\"$picture_url\" class=\"image\" border=\"0\" alt=\"$lang_display_image_php[view_fs]\" /><br />";
            $picList .= "</a>\n";
}else{
$picList .= "<a href=\"$picture_url_fullsize\" rel=\"lightbox[list]\" title=\"$pic_title\"></a>\n";
}
$i++;
}
}
return $picList;
}//End of second part


So this is probably not a final version?
Reducing the amount to something like 900 would be ok for me. I guess it's just a minor thing, and I now included this line on the end of the function

if ($i >900) break;
}
return $picList;
}//End of second part


but I would like to do it in a proper way if there is anything else I could improve?
I read for instance that you found a way to somehow return to the last picture being shown when stopping the slides? That would be interesting too.

The .js files of my gallery can be found here:

http://galerie.toontown-click.de/scripts/slideshow/js/prototype.js
http://galerie.toontown-click.de/scripts/slideshow/js/scriptaculous.js
http://galerie.toontown-click.de/scripts/slideshow/js/lightbox_s.js

Thanks for your answer!
cu,
Roli
°¿°

SaWey


Gephri

I've got LightBox[HighSlide Version] installed and would like to have the slide show redirect to what ever image the slideshow is stopped on.  I've found the instructions to change the typical LightBox version - but have trouble locating the code referenced in theme.php when I have the LightBox HighSlide Version.

Any ideas