Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorZenBug
    • CommentTimeMay 16th 2008
     
    Hi.

    My thumbnails seem to be out of order. See:
    http://www.northwestdivision.com/photos/photos.php?level=album&id=6

    If you mouse over them, you'll see that the URLs jump from #47 to #49. Changing settings in the control panel doesn't seem to help. I'm using the default theme.

    Any ideas?
    Thanks.
    •  
      CommentAuthorsidtheduck
    • CommentTimeMay 16th 2008
     
    What do you have set for the sort order in you Admin -> Options tab?
    •  
      CommentAuthorDeeJayOdie
    • CommentTimeMay 18th 2008
     
    I wouldn't worry too much about the id number being in order. The script gives you different ways to sort them, for example, by date taken, by filename. There are too many variables that could cause the id to not always be in order, for example, exif data, uploading, deleting of pictures. If you're really worried about making sure everything is in perfect order, just go into the database itself, and edit it the way you want it. But why do that? On my gallery I have it sort pictures by Date Taken in Descending order so that the most recent are on top. That seems to work well. Hope this helps.
    • CommentAuthorZenBug
    • CommentTimeMay 18th 2008
     
    @sidtheduck,
    I have them in the order Date Submitted > Ascending, but the order doesn't change when I modify that setting anyway.

    @DeeJayOdie,
    The problem is that the order in which they appear in the thumbnail display is not the order in which you'll see them if you click the "Next" button while viewing the full image. It's very confusing to the visitor. I mean if Photo B is to the right of Photo A in the thumbnails, then if I click Next while viewing Photo A, I should then see Photo B. But I don't. Make sense?
    •  
      CommentAuthorDeeJayOdie
    • CommentTimeMay 18th 2008 edited
     
    I see what you are saying. I never noticed that before. I'm going to check and see if my gallery does the same thing, cause if it does, I wouldn't want that happening either.
    ----------
    I don't seem to have that problem. Can you email me your "album.php" and "picture.php" pages.
    My email: webmaster@coreyavis.com
    • CommentAuthorZenBug
    • CommentTimeMay 18th 2008
     
    Will do. Thanks for the help.
    •  
      CommentAuthorDeeJayOdie
    • CommentTimeMay 18th 2008
     
    Can you send me plog-functions.php?
    •  
      CommentAuthorDeeJayOdie
    • CommentTimeMay 19th 2008
     
    On the options tab in the admin, what sort order are you using? By date submitted, date taken, caption, filename, or number of comments?
    • CommentAuthorZenBug
    • CommentTimeMay 19th 2008
     
    Date Submitted > Ascending.
    But changing that has no effect.
    •  
      CommentAuthorsidtheduck
    • CommentTimeMay 19th 2008
     
    ZenBug,

    In the file 'plog-functions.php' find the following code (starting at around line 1418 in the plogger_init_pictures() function):
    // this is the default
    $sortby = 'date';
    if (isset($arr['sortby']) && isset($sort_fields[$arr['sortby']])) {
    $sortby = $arr['sortby'];
    }

    $sortby = $sort_fields[$sortby];
    $sql .= " ORDER BY `$sortby` ";
    and change it to read:
    // this is the default
    $sortby = 'id';
    if (isset($arr['sortby']) && isset($sort_fields[$arr['sortby']])) {
    $sortby = $arr['sortby'];
    }

    $sortby = $sort_fields[$sortby];
    $sql .= " ORDER BY `$sortby` ";


    If you want it ASCending instead of DESCending, change the code just below that from:
    $sortdir = ' DESC';

    if (isset($arr['sortdir']) && (strcasecmp('asc',$arr['sortdir']) === 0)) {
    $sortdir = ' ASC';
    }
    to:
    $sortdir = ' ASC';

    if (isset($arr['sortdir']) && (strcasecmp('desc',$arr['sortdir']) === 0)) {
    $sortdir = ' DESC';
    }
    • CommentAuthorZenBug
    • CommentTimeMay 19th 2008
     
    Thanks. I tried, but to no avail. See?:
    http://www.northwestdivision.com/photos/photos.php?level=album&id=7

    ...The thumbnails go from #66 to #68 to #67.
    And I've just tried modifying the display order in Options, but nada.

    I'm assuming that it's not supposed to behave like this, so I might just have to reinstall this thing from scratch.
  1.  
    I've also got this problem on a plogger album. I'm digging around the code to see if I can see any reasons...
    What I've come up with so far is that $GLOBALS['image_list'] is used for the ordering of the "Next" and "Previous" links on pictures but the same order does not seem to be used to order the thumbnails on the album page.

    However, I can't seem to work out how the application works out the order of the thumbnails on screen. I'll keep digging around.
  2.  
    OK. I may have found something that helps - but I'd need a developer to confirm it's an issue and whether the solution is sensible / not going to cause a problem elsewhere.

    The problem appears to be that the SQL for the plogger_init_pictures() function (used to generate the album page) is different from the SQL in the plogger_init_picture() function (which creates the $GLOBALS["image_list"] used by the "Next" and "Previous" links on the picture page.

    At the end of the plogger_init_pictures() SQL statement, an additional "ORDER BY" is added:
    (Code line around 1439 in plog-functions.php)

    // again, this is needed because of the comment counting
    $sql .= ",p.`id` DESC ";

    However, this is not included in the plogger_init_picture() SQL when sorting by "date_submitted":
    (See code line around 1287 in plogger-functions.php for the switch statements controlling the sort order)

    When I commented out the "$sql .= ",p.`id` DESC ";" code, the album thumbnails displayed in the order expected and when using the "Next" and "Previous" links on the picture page, they followed the same order.

    However, I am unsure as to the effect of simply commenting out this line of code when using other sort orders for the album page. For me this isn't an issue as my album doesn't offer different orders to the user.

    Perhaps a solution along the lines of changing the code to the following would be better? (This is what needs to be looked at by a developer):
    if ($sortby == "num_comments") { $sql .= ",p.`id` DESC "; }
    •  
      CommentAuthorsidtheduck
    • CommentTimeMay 28th 2008
     
    CJ Internet,

    It looks like you are on the right track, but just commenting out that line for me still does not clear up the problem completely. I think there is a problem with a portion of the code previous to your highlighted one with a GROUP BY query:// grouping is needed to get comment count
    $sql .= " GROUP BY p.`id`";
    but just editing this portion out causes an error in the SQL query. It looks like this is not going to be a quick, easy fix, but may need some rewrites to keep the functions consistent with each other.
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 5th 2008 edited
     
    I think I have fixed all of the sorting issues in revision 546 of the SVN trunk. You can download it and test it out to make sure it does what you want.

    The only thing that is a little odd (IMO), is that if a user re-sorts the albums using the pull-down select menu, it stays that way across all albums for that session. If you close your browser and navigate back to the same folder, it will go back to the default setting. I was getting ready to remove all of this, but then I realized it was probably put in there for pagination (i.e. if a user sorts the album using the pulldown they would expect it to remain sorted the way they had selected when going from page 1 to page 2 of the album). If anyone has any good ideas either way of wanting to keep it in or a better way to keep the selected sort order across multiple album pages, let me know! :D

    Anyway, let me know what you think!