Slideshow link on the thumbnails.php page Slideshow link on the thumbnails.php page
 

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

Slideshow link on the thumbnails.php page

Started by jake, April 03, 2011, 02:34:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jake

Hello,
I have recently upgraded to Coppermine 1.5.12, and have been struggling with getting a slideshow link to work on my thumbnails page.  Because I use the enlargeit! plugin (which opens photos from the thumbnails.php page), my visitors need a slideshow link on the thumbnails.php page to have an opportunity to use the slideshow feature.
Previously I was able to work around this issue by adding a "Start slideshow" link to the thumbnails page by adding the add this code to my include/functions.inc.php file (below the "//Add Link for album if aid is set" code)

//Add Link for slideshow if aid is set
        {
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&slideshow=5000">Start slideshow</a>';
            $BREADCRUMB_TEXTS[2] = $CURRENT_ALBUM_DATA['Start slideshow'];
        }


My problem seems to be that cpg1.5.12 requires the pid#  in the url for the slideshow to work.  Example: http://woodardphotos.net/coppermine/displayimage.php?album=68&pid=8680&slideshow=5000

I tried to resolve the issue by altering the code (see below), which outputs the following url and causes the user to be directed to an error page.  See: http://woodardphotos.net/coppermine/displayimage.php?album=68&pid=&slideshow=5000


//Add Link for slideshow if aid is set
        {
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$PIC_DATA['pid'].'&slideshow=5000">Start slideshow</a>';
            $BREADCRUMB_TEXTS[2] = $CURRENT_ALBUM_DATA['Start slideshow'];
        }


Any suggestions would be greatly appreciated!
Thanks for your time.
- Jake

Αndré

Replace
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$PIC_DATA['pid'].'&slideshow=5000">Start slideshow</a>';
with
            $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';

jake

Andre,
Thanks so much for your time.  After changing my include/functions.inc.php file I get the following error:
While executing query 'SELECT pid FROM cpg15x_pictures WHERE aid = ' in include/functions.inc.php on line 2866

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

jake

Disregard the previous code, this is the actual error:
While executing query 'SELECT pid FROM cpg15x_pictures WHERE aid =  LIMIT 1' in include/functions.inc.php on line 2866

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1

Αndré

Please post your whole modified breadcrumb function from include/functions.inc.php.

jake

/**
* breadcrumb()
*
* Build the breadcrumb navigation
*
* @param integer $cat
* @param string $breadcrumb
* @param string $BREADCRUMB_TEXT
* @return
**/

function breadcrumb($cat, &$breadcrumb, &$BREADCRUMB_TEXT)
{
    global $lang_list_categories, $lang_common;
    global $CONFIG,$CURRENT_ALBUM_DATA, $CURRENT_CAT_NAME;

    $category_array = array();

    // first we build the category path: names and id
    if ($cat != 0) { //Categories other than 0 need to be selected

        if ($cat >= FIRST_USER_CAT) {

            $result = cpg_db_query("SELECT name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = " . USER_GAL_CAT);

            $row = mysql_fetch_assoc($result);

            $category_array[] = array(USER_GAL_CAT, $row['name']);

            $user_name = get_username($cat - FIRST_USER_CAT);

            if (!$user_name) {
                $user_name = $lang_common['username_if_blank'];
            }

            $category_array[] = array($cat, $user_name);
            $CURRENT_CAT_NAME = sprintf($lang_list_categories['xx_s_gallery'], $user_name);

            $row['parent'] = 1;

        } else {

            $result = cpg_db_query("SELECT p.cid, p.name FROM {$CONFIG['TABLE_CATEGORIES']} AS c,
                {$CONFIG['TABLE_CATEGORIES']} AS p
                WHERE c.lft BETWEEN p.lft AND p.rgt
                AND c.cid = $cat
                ORDER BY p.lft");

            while ( ($row = mysql_fetch_assoc($result)) ) {
                $category_array[] = array($row['cid'], $row['name']);
                $CURRENT_CAT_NAME = $row['name'];
            }

            mysql_free_result($result);
        }
    }

    $breadcrumb_links = array();
    $BREADCRUMB_TEXTS = array();

    // Add the Home link  to breadcrumb
    $breadcrumb_links[0] = '<a href="index.php">'.$lang_list_categories['home'].'</a>';
    $BREADCRUMB_TEXTS[0] = $lang_list_categories['home'];

    $cat_order = 1;

    foreach ($category_array as $category) {

        $breadcrumb_links[$cat_order] = "<a href=\"index.php?cat={$category[0]}\">{$category[1]}</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $category[1];

        $cat_order += 1;
    }

    //Add Link for album if aid is set
    if (isset($CURRENT_ALBUM_DATA['aid'])) {
        $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];
    }
       
    //Add Link for slideshow if aid is set
        {
            $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';
    }

    // Build $breadcrumb,$BREADCRUMB_TEXT from _links and _TEXTS
    theme_breadcrumb($breadcrumb_links, $BREADCRUMB_TEXTS, $breadcrumb, $BREADCRUMB_TEXT);
}  // function breadcrumb

Αndré

Find
    //Add Link for album if aid is set
    if (isset($CURRENT_ALBUM_DATA['aid'])) {
        $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];
    }
       
    //Add Link for slideshow if aid is set
        {
            $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
            $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';
    }

and replace with
    //Add Link for album if aid is set
    if (isset($CURRENT_ALBUM_DATA['aid'])) {
        $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];

        //Add Link for slideshow if aid is set
        $pid = mysql_result(cpg_db_query("SELECT pid FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$CURRENT_ALBUM_DATA['aid']} LIMIT 1"), 0);
        $breadcrumb_links[2] = '<a href="displayimage.php?album='.$CURRENT_ALBUM_DATA['aid'].'&pid='.$pid.'&slideshow=5000">Start slideshow</a>';
    }

jake

Αndré,
Your code worked like a charm!  Thank you so much!  You are a hero! 

Αndré

Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
you can tag your answer as "solved" by clicking on the little image in your initial posting on your thread.