coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: oscar_rocha on September 17, 2007, 05:41:52 PM

Title: Navigation issue
Post by: oscar_rocha on September 17, 2007, 05:41:52 PM
Hi everybody,I will appreciate so much you contribution:

I use Coppermine Photo Gallery 1.4.8 (stable) to manage pictures and contents that are updated from cellular phone.

As I'm handling with so many uploads, when you're browsing an album (ex. lastuploads) and click over a thumbnail to view the image inside "displayimage.php" sometimes it takes you to the wrong image as in that moment a new picture was uploaded (the picture i clicked had "pos=1" but when the new picture was uploaded, it position changes changes to "pos=2").

Is there any way to solve this? maybe linking from thumbnails.php to a pic_id instead of a position?

Thanx!

cpg rocks
Title: Re: Navigation issue
Post by: Joachim Müller on September 17, 2007, 06:13:55 PM
With cpg1.4.x: no. Will be taken care of in cpg1.5.x (not released yet).

Quote from: oscar_rocha on September 17, 2007, 05:41:52 PMI use Coppermine Photo Gallery 1.4.8
It is absolutely mandatory to upgrade to the most recent version (currently cpg1.4.13) for security reasons.
Title: Re: Navigation issue
Post by: oscar_rocha on September 21, 2007, 03:15:00 PM
I solved this issue changing few lines:

In displaimage.php, changed:
// 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];

}

With:
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);
    if (empty($album))
    $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];

}


As you see, I just added the: if (empty($album)) avlidation.
And making changes in thumbnails.php and include/themes.inc.php in order to show all the links to displayimage.php (from thumnails.php and from the filmstrip) also with the pid parameter.

Hope this helps...
Title: Re: Navigation issue
Post by: Joachim Müller on September 21, 2007, 04:13:37 PM
Thanks for returning and sharing your solution.