forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: rrwwxx on August 20, 2007, 02:50:57 am

Title: The selected album/file does not exist !
Post by: rrwwxx on August 20, 2007, 02:50:57 am
Hi,
I am nearly finished with my second cpg gallery but I have a strange result when rating images or sending eCards.
I always get to read the error message

The selected album/file does not exist ! 

when the gallery wants to redirect me to a certain image via

/displayimage.php?pos=-3134

for example. Is the negative number correct or did I mess around with something due to my numerous modifications on the original scripts? Changing it to a positive number didn't help.
My gallery can be watched here (http://galerie.toontown-click.de/index.php?lang=english).

I also receive this message when I try to click on an image link in an eCard mail.
Thanks for help!
cu,
Roli

Title: Re: The selected album/file does not exist !
Post by: Nibbler on August 20, 2007, 03:00:27 am
If the http://galerie.toontown-click.de/displayimage.php?pos=-xxx links do not work then you have probably over modified the code.
Title: Re: The selected album/file does not exist !
Post by: rrwwxx on August 20, 2007, 07:58:37 am
Well I actually haven't changed a single thing in displayimage.php compared to that other gallery I was using. And I just checked some posID's: http://galerie.toontown-click.de/displayimage.php?album=1&pos=288 does work for instance, but it shows a different number (304) as its posID:

Is there any possibility to reindex the whole database? I have no idea where these errors come from. I batch-uploaded more than 3000 images via FTP and it seems that it is messed up with every picture larger than ID 443 ?
I invoked update.php and it did not fix it.

Thanks for your help!
cu,
Roli
Title: Re: The selected album/file does not exist !
Post by: Nibbler on August 20, 2007, 09:34:59 am
I don't know what you mean by reindex. update.php is to update you from one version of Coppermine to the next; don't expect it to fix anything.
Title: Re: The selected album/file does not exist !
Post by: rrwwxx on August 20, 2007, 09:42:07 am
I only tried that update routine because I didn't know whether it would do some kind of reindexing.
What I mean by this is that I believe that somehow these pos numbers have been stored in a wrong matter, order or whatever? I don't know how this could have happened because I only used ordinary batch routines to include the images into the database.
cu,
Roli
Title: Re: The selected album/file does not exist !
Post by: rrwwxx on August 20, 2007, 02:00:09 pm
I see there is no official method to renumber the whole image content in the database. What I did by now was a rescale of thumbs and normal display by going through all albums using the official method invoked by util.php.
And I still have that error. Some numbers do work properly, some others dont. Strange!?!

Could someone telll me how the forum software is indexing (numbering) the images or how the PID-Numbers are translated back into their references in order to retrieve the appropriate images?

And what could I do to fix this odd behaviour? I am able to perform SQL statements on the db, but I haven't done that yet.
As far as I am concerned I believe I also did not touch the core routines of cpg, but instead I only added some visual modifications to the gallery.
cu,
Roli

Title: Re: The selected album/file does not exist !
Post by: rrwwxx on August 21, 2007, 05:01:19 pm
I found the problem now that is bugging me. Haven't got a final solution yet, but at least I know now where the problem came from. It could be interesting to some of you who might come across this problem as well after they've included the same modifications as I did by now.

Besides other visual modifications I have also included the LightBox JS for Fullsize Popup Image (http://forum.coppermine-gallery.net/index.php?topic=35539.0). But because in that thread it is is pretty chaotic to find the final solution code, I was using the following lines in themes.php which were derived from a post by SaWey (http://forum.coppermine-gallery.net/index.php?topic=35539.msg190729#msg190729) over there:
Code: [Select]
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
 //Second part of lightbox update
function lightbox_list($picId)
{ $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, 'fullsize');
}
$pic_title = ($picture['title'] ? $picture['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1", htmlspecialchars($picture['filename'])), "_", " "));
if ($picture['pid'] == $pid) {
$picList .= "<a href=\"$picture_url\" rel=\"lightbox[list]\" title=\"$pic_title\">";
            $picList .= "<img src=\"$picture_url\" class=\"image\" border=\"0\" alt=\"Click to view full size image\" /><br />";
            $picList .= "</a>\n";
}else{
$picList .= "<a href=\"$picture_url\" rel=\"lightbox[list]\" title=\"$pic_title\"></a>\n";
}
$i++;
}
}
return $picList;
}
//End of second part
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

There is a another modification needed in the same file which can be found in the function theme_html_picture()

Code: [Select]
   
...
if ($mime_content['content']=='image') {
        if (isset($image_size['reduced'])) {
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
        //First part of lightbox update
$pic_html = lightbox_list($CURRENT_PIC_DATA['pid']);
//End of first part
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

        } else {
...

I was adding a minor modification to that because I wanted some DHTML tooltip appearing on the mousepointer (fully explained here (http://forum.coppermine-gallery.net/index.php?topic=45873.0)):

Code: [Select]
   
function theme_html_picture()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
    global $album, $comment_date_fmt, $template_display_media;
    global $lang_display_image_php, $lang_picinfo, $lang_display_thumbnails;
    global $mypicinfo;

the last line is added here. The next changes are followed a little further down:
Code: [Select]
  if ($mime_content['content']=='image') {
       $pic_title3 = $lang_picinfo['Album name']." : ". $mypicinfo['album']."\n".
        $lang_display_thumbnails['filename'].$CURRENT_PIC_DATA['filename']."\n".
        $lang_display_thumbnails['filesize'].($CURRENT_PIC_DATA['filesize'] >> 10).$lang_byte_units[1]." kB\n".
        $lang_display_thumbnails['dimensions'].$CURRENT_PIC_DATA['pwidth']."x".$CURRENT_PIC_DATA['pheight']." Pixel\n".
        $lang_picinfo['Date Added']." : ".  $mypicinfo['date']."\n".
        $lang_picinfo['Displayed']." : ". $mypicinfo['disp']."\n";
        if ($mypicinfo['votes'] != "") {
               $pic_title3.=  sprintf($lang_picinfo['Rating'], $mypicinfo['votes'])." : ". str_repeat("*",(int)$mypicinfo['rating']);
               $pic_title3=str_replace("(1 Stimmen","(1 Stimme",$pic_title3);
               $pic_title3=str_replace("(1 Votes","(1 Vote",$pic_title3);
            }

$pic_title2=str_replace("\n","<br />",$pic_title3);
        $onmousetxt="Tip('$pic_title2')"; 
   
        if (isset($image_size['reduced'])) {
            $onmousetxt="Tip('$pic_title2"."<br /><br />".$lang_display_image_php['view_fs']."')";
            $pic1_html = "onmouseover=\"" . $onmousetxt . "\" ";

// First part of lightbox update
         $pic_html = lightbox_list($CURRENT_PIC_DATA['pid'],$pic1_html);
         $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;

// End of first part of lightbox update
        } else {
            $pic_html = "<img onmouseover=\"" . $onmousetxt . "\" src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
        }
    } elseif ($mime_content['content']=='document') {

...

The rest remained unchanged here. My modified second part of the Lightbox JS script looks like this

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

I hope you can spot the differences and see my goal behind it. It was leading to a result that can be watched here (http://www.hair-factory10.de/xg/displayimage.php?album=26&pos=0) for example. But in the very same example you can also see the error I was talking already earlier about in the first post of this thread! If you click on the link shown underneath the image
http://www.hair-factory10.de/xg/displayimage.php?pos=-737
it will tell you The selected album/file does not exist ! in that gallery too!

So I was already having that problem before but never noticed it in that earlier adoption of my modified version of cpg 1.4.12. And I don't think that error is due to my own modifications on the code, which means it was somehow errorneous before anyhow. However it is not so easy to find, as many links will work correctly.
I still don't know exactly why that error comes up, but after I changed some bits of the code to a later adoption of the Lightbox JS mod script, it disappeared. Yet, there is another error happening right now, but I will follow that track...

After I was asking in the Lightbox thread about solution to reduce the number of images for the slideshow for those cases of large gallery libraries, he answered (http://forum.coppermine-gallery.net/index.php?topic=35539.msg220339#msg220339) and pointed me to a different implementation of the Lightbox JS script in here (http://forum.coppermine-gallery.net/index.php?topic=35539.msg192846#msg192846):

Code: [Select]
//Second part of lightbox update
function lightbox_list($picId)
{
$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 href=\"$picture_url_fullsize\" rel=\"lightbox[list]\" title=\"$pic_title\">";
            $picList .= "<img src=\"$picture_url\" class=\"image\" border=\"0\" alt=\"Klik op de foto om originele grootte te bekijken\" /><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
After I was using this code I don't see my initial errorneous behaviour with the message 'The selected album/file does not exist' anymore!
Instead I am now getting to see an empty image  ::) - but I guess that should be easy to find. At least I hope that.
cu,
Roli
Title: Re: The selected album/file does not exist !
Post by: rrwwxx on August 21, 2007, 07:48:04 pm
Found the problem now! Yeehaa!

The error was lying in the first part of lightbox update section. Because of all those mixed up instructions in that thread concerning to earlier and later versions of the modified code, I was still having it like this:
Code: [Select]
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
        //First part of lightbox update
$pic_html = lightbox_list($CURRENT_PIC_DATA['pid']);
//End of first part
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

instead it should be like this

Code: [Select]
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/
        //First part of lightbox update
$pic_html = lightbox_list($CURRENT_PIC_DATA);
//End of first part
/*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*/

cu,
Roli