Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 ... 8 9 10 11 [12] 13 14 15 16 17   Go Down

Author Topic: LightBox JS for Fullsize Popup Image  (Read 436327 times)

0 Members and 1 Guest are viewing this topic.

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #220 on: August 20, 2007, 08:38:05 am »

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!
Logged

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #221 on: August 20, 2007, 08:40:46 am »

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/.
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #222 on: August 20, 2007, 09:26:32 am »

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>'
Logged

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #223 on: August 20, 2007, 03:34:31 pm »

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

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #224 on: August 20, 2007, 05:28:41 pm »

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!
Logged

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #225 on: August 20, 2007, 05:33:29 pm »

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']);
}
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #226 on: August 20, 2007, 05:50:15 pm »

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'
Logged

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #227 on: August 20, 2007, 07:46:11 pm »

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?
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #228 on: August 20, 2007, 08:27:00 pm »

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

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #229 on: August 20, 2007, 08:49:42 pm »

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?
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #230 on: August 20, 2007, 08:58:53 pm »

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...
Logged

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #231 on: August 20, 2007, 09:26:47 pm »

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.
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #232 on: August 20, 2007, 09:37:48 pm »

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.
Logged

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #233 on: August 20, 2007, 09:55:55 pm »

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.
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #234 on: August 20, 2007, 09:58:26 pm »

just replace it with this:

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

zenlunch

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: LightBox JS for Fullsize Popup Image
« Reply #235 on: August 20, 2007, 10:07:29 pm »

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

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #236 on: August 20, 2007, 10:14:13 pm »

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

rrwwxx

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 51
Re: LightBox JS for Fullsize Popup Image
« Reply #237 on: August 20, 2007, 11:33:17 pm »

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

Code: [Select]
################################################
//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:

Code: [Select]
//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
Code: [Select]
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
°¿°
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: LightBox JS for Fullsize Popup Image
« Reply #238 on: August 20, 2007, 11:45:04 pm »

To set a max amount of images in the slide show, click here: http://forum.coppermine-gallery.net/index.php?topic=35539.msg192846#msg192846

For the returning to the page where the slide show stopped, click here: http://forum.coppermine-gallery.net/index.php?topic=35539.msg206971#msg206971
Logged

Gephri

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 235
Re: LightBox JS for Fullsize Popup Image
« Reply #239 on: August 21, 2007, 01:32:41 am »

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
Logged
Pages: 1 ... 8 9 10 11 [12] 13 14 15 16 17   Go Up
 

Page created in 0.027 seconds with 20 queries.