forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Visuals => Topic started by: martinha on September 24, 2004, 03:36:02 pm

Title: Image captions shown in slideshow mode
Post by: martinha on September 24, 2004, 03:36:02 pm
For me there are very few new additional features required in future releases of Coppermine. :)

I would like to see the whole thing XHTML-compliant (I think v1.4 will be  ;D), and it would be nice to see a caption shown for images shown in slideshow mode.  ::)

I know there is a hack for this but it seems a tad clumsy and I can't seem to get it to work with my installation of v.1.3.2  ???
Title: Re: Image captions shown in slideshow mode
Post by: Tranz on September 24, 2004, 03:46:53 pm
A bit demanding, no? ;) This is a volunteer effort and the developers do have other priorities beyond CPG. They still try hard to produce a great application with features that benefit a big enough number of people. Beyond that, there are people who create mods/hacks to build upon CPG's core code. Perhaps you should try to help the developers out so that they can focus on development rather than support. :)
Title: Re: Image captions shown in slideshow mode
Post by: martinha on September 27, 2004, 12:56:57 pm
Quote
A bit demanding, no?

Hardly demanding. :( Just something to make the slidewhow feature more complete. As far as XHTML is concerned I understood that v1.4 when released it is complete will be compliant.


Coppermine is excellent in my view and this addition to the slideshow would (in my mind) make it complete...
Title: Re: Image captions shown in slideshow mode
Post by: mstralka on September 27, 2004, 02:19:09 pm
The "clumsy" caption mod http://forum.coppermine-gallery.net/index.php?topic=9247.0 works fine for 1.3.2, so if you had problems with it then you didn't follow the instructions correctly.  I agree that displaying the caption in a text box is not ideal, but I could not find another way that worked.  Maybe you can work on and post an improvement?

-Mark
Title: Re: Image captions shown in slideshow mode
Post by: RatKing on September 29, 2004, 09:23:08 pm
FOR 1.4.9 USERS please see my last post about this on page 2 http://forum.coppermine-gallery.net/index.php?topic=10265.msg173257#msg173257 (http://forum.coppermine-gallery.net/index.php?topic=10265.msg173257#msg173257)


A neater solution to this issue isn't that hard.....

In functions.inc.php change this line:
Code: [Select]
            $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid';to
Code: [Select]
            $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, title';
then in slideshow.inc.php below:
Code: [Select]
var Pic = new Array() // don't touch thisadd
Code: [Select]
var Title = new Array() // don't touch this
change:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        echo "Pic[$i] = '" . $picture_url . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}
to:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        if ( $picture['title'] ) $Title = $picture['title']; else $Title = $picture['filename'];
        echo "Pic[$i] = '" . $picture_url . "'\n";
        echo "Title[$i] = '" . $Title . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}

change:
Code: [Select]
function runSlideShow(){
   if (xIE4Up){
     document.images.SlideShow.style.filter="blendTrans(duration=2)"
     document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow.filters.blendTrans.Apply()
   }
   document.images.SlideShow.src = preLoad[j].src;
   if (xIE4Up){
     document.images.SlideShow.filters.blendTrans.Play()
   }

   pos = j

   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
   preLoadPic(j)
}
to
Code: [Select]
function runSlideShow(){
   if (xIE4Up){
     document.images.SlideShow.style.filter="blendTrans(duration=2)"
     document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow.filters.blendTrans.Apply()
   }
   document.getElementById('Title').innerHTML = Title[j];
   document.images.SlideShow.src = preLoad[j].src;
   if (xIE4Up){
     document.images.SlideShow.filters.blendTrans.Play()
   }

   pos = j

   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
   preLoadPic(j)
}

And in displayimage.php below:
Code: [Select]
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
        '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
        '{ADMIN_MENU}' => '',
        );
add
Code: [Select]
    starttable();
    echo <<<EOT
        <tr><td align="center" class="navmenu" style="white-space: nowrap;"><div id=Title></div></td></tr>

EOT;
    endtable();

That will do the trick and will work in every single theme.... :)
Title: Re: Image captions shown in slideshow mode
Post by: RatKing on September 29, 2004, 09:27:03 pm
If you want to see a working version go to http://www.ratking.net
Title: Re: Image captions shown in slideshow mode
Post by: martinha on October 04, 2004, 06:08:58 pm
@RatKing - many, many thanks for this hack - it works like a dream  ;D

Could this be included in any future releases?  :)
Title: Re: Image captions shown in slideshow mode
Post by: martinha on October 05, 2004, 10:24:38 am
...although I've just noticed that does not seem to work on all my albums? I can't seem to work out why  :\'(


Check out http://cgi.martinhart.force9.co.uk/
Title: Re: Image captions shown in slideshow mode
Post by: RatKing on October 05, 2004, 12:09:34 pm
FOR 1.4.9 USERS please see my last post about this on page 2 http://forum.coppermine-gallery.net/index.php?topic=10265.msg173257#msg173257 (http://forum.coppermine-gallery.net/index.php?topic=10265.msg173257#msg173257)


I had a little look and the problem is in the names used for the title's in your: Home > Holidays Abroad > 2002 The Splendours of Venice & Lombardy

There is a title by the name of: Title[13] = 'Gondolas outside St Mark's Square, Venice' that causes an issue because of the Mark's

Now you can solve this in several ways but the best would be to make a change in the PHP (it was my bad not to think of this before)...

This code in slideshow.inc.php should be:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        if ( $picture['title'] ) $Title = $picture['title']; else $Title = $picture['filename'];
        echo "Pic[$i] = '" . htmlspecialchars($picture_url, ENT_QUOTES) . "'\n";
        echo "Title[$i] = '" . htmlspecialchars($Title, ENT_QUOTES) . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}

instead of:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        if ( $picture['title'] ) $Title = $picture['title']; else $Title = $picture['filename'];
        echo "Pic[$i] = '" . $picture_url . "'\n";
        echo "Title[$i] = '" . $Title . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}

I have not tested this but I am pretty sure this will do the trick. :-)
Title: Re: Image captions shown in slideshow mode
Post by: martinha on October 05, 2004, 06:59:31 pm
Gr8 -  now works perfectly with all albums (including those containing images with quotes et al.)  8) 8) 8)
Title: Re: Image captions shown in slideshow mode
Post by: poubao on October 05, 2004, 10:59:03 pm
bonjour,
i test your mod, but it seem not working, the slideshow stay at the first pic and dont run without error, ???
any idea to solve
poubao
Title: Re: Image captions shown in slideshow mode
Post by: martinha on October 06, 2004, 02:45:05 pm
poubao:

First apply the changes listed by RatKing at the start of this thread and then make the change he suggests further down. Your problme possibly lies in your images having titles with apostrophies ( 's) in their titles?

This solved the problem on mine.... :)

martin
Title: Re: Image captions shown in slideshow mode
Post by: morphob on October 26, 2004, 08:08:56 pm
Is this supposed to show the caption as well as the title? 

Works great for showing the title, but I'm not sure if I missed something.
Title: Re: Image captions shown in slideshow mode
Post by: RatKing on November 02, 2004, 01:11:35 pm
The trick is it shows the caption if available and the file name if there is no caption. That way you will always see something, and the slide show does work have a look at my site (it usses the cade shown above)
Title: Re: Image captions shown in slideshow mode
Post by: slfear on March 23, 2005, 03:23:57 pm
Thanks Ratking for the mod...works great!

steve
Title: Re: Image captions shown in slideshow mode
Post by: caplan8293 on August 26, 2005, 03:55:01 pm
Works for me too, this is great.  I suggest that this be part of the core application.  Thanks a lot.
Title: Re: Image captions shown in slideshow mode
Post by: willstein on October 29, 2005, 11:29:32 pm
hmm seems to be working for everybody else, i tried two times, and must be doing something wrong.

I'm not getting any errors, just the slidehshow isn't running. Any suggestions?
Title: Re: Image captions shown in slideshow mode
Post by: Rallemann on January 02, 2006, 03:33:02 am
Well
This mod has worked under 1.3x really good. Today I installed 1.43 and I noticed that in displayimage.php is not the code I have to add to:
And in displayimage.php below:
Code: [Select]
   $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
        '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
        '{ADMIN_MENU}' => '',
        );
add
Code: [Select]
   starttable();
    echo <<<EOT
        <tr><td align="center" class="navmenu" style="white-space: nowrap;"><div id=Title></div></td></tr>

EOT;
    endtable();

I think this code was changed because of any reason, so this mod has to be overworked.
Sorry but I am not able to do this - can you help me?
I suppose that it won't be very difficult
Title: Re: Image captions shown in slideshow mode
Post by: Joachim Müller on January 02, 2006, 07:04:35 am
http://forum.coppermine-gallery.net/index.php?topic=24540.0
Title: Re: Image captions shown in slideshow mode
Post by: phatbloke on February 23, 2006, 01:47:16 pm
Rallemann

You will now find the missing line of code in includes/themes.inc.php and you can add the line in below it as noted in the instructions.
This fix now works for me in v1.4.3


Also the line in functions.inc.php has a couple extra values, just add title to the line inside the quotes as indicated.
Title: Re: Image captions shown in slideshow mode
Post by: Rallemann on February 28, 2006, 06:51:42 pm
it works fine, thanks

mod can be marked as "working with 1.44" :)  :-*
Title: Re: Image captions shown in slideshow mode
Post by: pwiedower on April 18, 2006, 12:34:12 am
Ok, so maybe I am slow.  I have tried this twice with the same result.  I the following at the top of the screen when I begin a slideshow, EOT; endtable(); starttable(); echo template_eval( , Array); endtable(); starttable(); echo <<.  I even upgraded last night thinking I was doing something wrong.  My site is www.wiedowerfamily.com.  Any help would be appricated.
Title: Re: Image captions shown in slideshow mode
Post by: pwiedower on April 18, 2006, 12:57:48 am
I am not sure exactly what I did, but I got it to work.  Thanks
Title: Re: Image captions shown in slideshow mode
Post by: BrianD on June 05, 2006, 06:09:11 pm
Using this mod on 1.3.5.  Love it!   

Only problem, & is being printed as &amp;

How do I fix?

Thanks.

Brian
Title: Re: Image captions shown in slideshow mode
Post by: BrianD on July 18, 2006, 07:21:23 pm
I know 1.3 really isn't supported anymore but does anyone have a recomendation for me?

Thanks!
Brian D
Title: Re: Image captions shown in slideshow mode
Post by: BrianD on July 19, 2006, 06:08:32 pm
For those using this mod, I figured out why all my & were converting to &amp;  It turns out the function htmlspecialchars was the culprit.  After doing some digging and learning what that function actually did  :) ,  I decided to use addslashes instead. So to expand on RatKings reply (http://forum.coppermine-gallery.net/index.php?topic=10265.msg48034#msg48034),

Use:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        if ( $picture['title'] ) $Title = $picture['title']; else $Title = $picture['filename'];
        echo "Pic[$i] = '" . htmlspecialchars($picture_url, ENT_QUOTES) . "'\n";
        echo "Title[$i] = '" . addslashes($Title) . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}

instead of:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        if ( $picture['title'] ) $Title = $picture['title']; else $Title = $picture['filename'];
        echo "Pic[$i] = '" . $picture_url . "'\n";
        echo "Title[$i] = '" . $Title . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}

For those interested:
htmlspecialchars => http://www.zend.com/manual/function.htmlspecialchars.php
addslashes => http://www.zend.com/manual/function.addslashes.php

Brian
Title: Re: Image captions shown in slideshow mode
Post by: RatKing on October 01, 2006, 10:15:12 am
After a way to long abcense I have some time and tried my hand add making a mess of 1.4.9  ;D

So here is, for those of you that didn't get it working them selfs, the version that will work for 1.4.9


In functions.inc.php change this line:
Code: [Select]
            $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, keywords';to
Code: [Select]
            $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, keywords, title';
then in slideshow.inc.php below:
Code: [Select]
var Pic = new Array() // don't touch thisadd
Code: [Select]
var Title = new Array() // don't touch this
change:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        echo "Pic[$i] = '" . $picture_url . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}
to:
Code: [Select]
    if (is_image($picture['filename'])) {
        if ($CONFIG['make_intermediate'] && $condition ) {
            $picture_url = get_pic_url($picture, 'normal');
        } else {
            $picture_url = get_pic_url($picture, 'fullsize');
        }

        if ( $picture['title'] ) $Title = $picture['title']; else $Title = $picture['filename'];
        echo "Pic[$i] = '" . htmlspecialchars($picture_url, ENT_QUOTES) . "'\n";
        echo "Title[$i] = '" . addslashes($Title) . "'\n";
        if ($picture['pid'] == $pid) {
            $j = $i;
            $start_img = $picture_url;
        }
        $i++;
    }
}

change:
Code: [Select]
function runSlideShow(){
   if (xIE4Up){
     document.images.SlideShow.style.filter="blendTrans(duration=2)"
     document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow.filters.blendTrans.Apply()
   }
   document.images.SlideShow.src = preLoad[j].src;
   if (xIE4Up){
     document.images.SlideShow.filters.blendTrans.Play()
   }

   pos = j

   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
   preLoadPic(j)
}
to
Code: [Select]
function runSlideShow(){
   if (xIE4Up){
     document.images.SlideShow.style.filter="blendTrans(duration=2)"
     document.images.SlideShow.style.filter= "blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow.filters.blendTrans.Apply()
   }
   document.getElementById('Title').innerHTML = Title[j];
   document.images.SlideShow.src = preLoad[j].src;
   if (xIE4Up){
     document.images.SlideShow.filters.blendTrans.Play()
   }

   pos = j

   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
   preLoadPic(j)
}

And in themes.inc.php, below:
Code: [Select]
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
        '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
        '{ADMIN_MENU}' => '',
        );
add
Code: [Select]
    starttable();
    echo <<<EOT
        <tr><td align="center" class="navmenu" style="white-space: nowrap;"><div id=Title></div></td></tr>

EOT;
    endtable();

That will do the trick and will work in every single theme.... :)
Title: Re: Image captions shown in slideshow mode
Post by: mingmann on November 14, 2007, 11:13:29 pm
I've used the above code but instead of
        if ( $picture['title'] ) $Title = $picture['title']; else $Title = $picture['filename'];

I substituted picture title with picture caption so my description would show up.
        if ( $picture['caption'] ) $Title = $picture['caption']; else $Title = $picture['filename'];

This does seem to do what I want to do, which is to have the caption with each picture during slideshow. The problem I am having is that for those pictures with long caption, the caption would just show up in one long row all the way across the page.  This stretches the width of the page.  How can I get it so the caption wraps around so it is roughly the width of the picture?

You can see examples here:  http://mingywu.com/copper/thumbnails.php?album=44.  Click on slideshow.

Title: Re: Image captions shown in slideshow mode
Post by: mingmann on November 16, 2007, 12:09:38 am
Hmmm. Solved my own question.

Use "wrap" instead of "nowrap" in themes.inc.php.

        <tr><td align="center" class="navmenu" style="white-space: wrap;"><div id=Title></div></td></tr>

Seems to work.
Title: Re: Image captions shown in slideshow mode
Post by: Joachim Müller on November 16, 2007, 09:07:54 am
Use "wrap" instead of "nowrap" in themes.inc.php.
Don't edit themes.inc.php - under no circumstances. That's why the dev team doesn't recommed to use this mod at all (since RatKing's original instructions say to modify that file). Modify themes/yourtheme/theme.php instead (whenever RatKing instructs you to use include/themes.inc.php).
Title: Re: Image captions shown in slideshow mode
Post by: ThaiJan on October 18, 2009, 07:44:40 pm
Don't edit themes.inc.php - under no circumstances. That's why the dev team doesn't recommed to use this mod at all (since RatKing's original instructions say to modify that file). Modify themes/yourtheme/theme.php instead (whenever RatKing instructs you to use include/themes.inc.php).
Know this is very old, but I risk getting my head ripped of by bringing it up having spend many hours searching and reading posts, since I really would like to have the picture Title to show up in slideshow mode.

I want to follow Joachim's advice not to edit themes.inc.php, but being an almost complete blank novice in PHP I simply can't manage to figure out where or how to place the code in the themes/classic/theme.php instead. Have studied the themes/sample/theme.php carefully, but still blank.

Anybody who can help a beginner?
Title: Re: Image captions shown in slideshow mode
Post by: ThaiJan on October 18, 2009, 08:23:48 pm
Know this is very old, but I risk getting my head ripped of by bringing it up having spend many hours searching and reading posts, since I really would like to have the picture Title to show up in slideshow mode.

I want to follow Joachim's advice not to edit themes.inc.php, but being an almost complete blank novice in PHP I simply can't manage to figure out where or how to place the code in the themes/classic/theme.php instead. Have studied the themes/sample/theme.php carefully, but still blank.

Anybody who can help a beginner?
I'm deeply sorry, I realize I posted this in a wrong place. Can't delete, edit, or report it to Moderator though.

Moderator, please just delete these two posts of mine while receiving my excuse for my mistake.
Title: Re: Image captions shown in slideshow mode
Post by: Joachim Müller on October 19, 2009, 08:44:11 am
We never delete threads nor postings because they were solved. Instead of asking your posting to be removed, why don't you resolve your posting by saying what you did to figure out your issues. We only delete spam and other abusive postings.
Title: Re: Image captions shown in slideshow mode
Post by: ThaiJan on October 19, 2009, 09:28:02 am
We never delete threads nor postings because they were solved. Instead of asking your posting to be removed, why don't you resolve your posting by saying what you did to figure out your issues. We only delete spam and other abusive postings.
Joachim, I haven't resolved it yet, but since I by mistake posted here I won't post it in the support forum also. That would be double posting.

It wasn't untill I had clicked submit that I realized where my searches had taken me and I was posting where there is no support and requests for such aren't allowed. That's why I requested this posting to be deleted first not to mess things up.

I feel real sorry about this mistake and the inconvinience it is for you and others on this board.

If I can find a solution I will of course share it on the board as I did on another topic I marked "Solved".