Image captions shown in slideshow mode Image captions shown in slideshow mode
 

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]

Main Menu

Image captions shown in slideshow mode

Started by martinha, September 24, 2004, 03:36:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

martinha

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

Tranz

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. :)

martinha

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

mstralka

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
GO IRISH

RatKing

#4
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


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

In functions.inc.php change this line:
            $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid';
to
            $select_columns = 'pid, filepath, filename, url_prefix, filesize, pwidth, pheight, ctime, aid, title';

then in slideshow.inc.php below:
var Pic = new Array() // don't touch this
add
var Title = new Array() // don't touch this

change:
    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:
    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:
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
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:
    $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
        '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
        '{ADMIN_MENU}' => '',
        );

add
    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.... :)

RatKing


martinha

@RatKing - many, many thanks for this hack - it works like a dream  ;D

Could this be included in any future releases?  :)

martinha

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

RatKing

#8
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


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:
    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:

    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. :-)

martinha

Gr8 -  now works perfectly with all albums (including those containing images with quotes et al.)  8) 8) 8)

poubao

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
L'incohérence de ceux qui nous dirigent, l'incompétence de ceux qui nous commandent,sont un vibrant hommage pour ceux qui exécutent.
                                          **Général Patton**

martinha

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

morphob

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.

RatKing

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)

slfear

Thanks Ratking for the mod...works great!

steve

caplan8293

Works for me too, this is great.  I suggest that this be part of the core application.  Thanks a lot.
caplan8293

willstein

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?

Rallemann

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:
Quote from: RatKing on September 29, 2004, 09:23:08 PM
And in displayimage.php below:
   $params = array('{CELL_HEIGHT}' => $CONFIG['picture_width'] + 100,
       '{IMAGE}' => '<img src="' . $start_img . '" name="SlideShow" class="image" /><br />',
       '{ADMIN_MENU}' => '',
       );

add
   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

Joachim Müller


phatbloke

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.