Not signed in (Sign In)

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

    • CommentAuthoremitind
    • CommentTimeMar 3rd 2006
     
    Hey, firstly thanks for the work it looks really good!

    However I do have a rather persistant niggle. When importing 100+ photos, or even just a few, they seem to be listed in a random order and not ordered by filename or anything. This makes it very difficult to go along and write captions in a sequence since the photos are all over the place.

    The same issue is in the 'manage' section of the admin panel.

    I have had a quick look at the code but can't figure out how to order this?

    Thanks.
    • CommentAuthoremitind
    • CommentTimeMar 7th 2006
     
    Anyone?
    •  
      CommentAuthormike
    • CommentTimeMar 7th 2006
     
    Well, for importing, the order of the files is simply the order in which the filenames are pulled off the filesystem.

    In plog-import.php, line 10, see this code?

    $files = get_files($config['basedir'] . 'uploads');


    That is simply pulling all the filenames from the upload folder into an array. So I'm guessing you can just sort that array before processing with something like:

    sort($files);


    Right at line 11. More information for sorting arrays can be found at http://us2.php.net/manual/en/function.sort.php

    As for the manage interface, that is simple modifying the SQL to return results in your desired order. I'll get to that later if I have time.
    • CommentAuthoremitind
    • CommentTimeMar 7th 2006 edited
     
    Ok thanks Mike :)

    I finally found the place to order the pictures on plog-manage.php:

    line 504

    else if ($level == "pictures"){
    $cond = "WHERE `parent_album` = '$_REQUEST[id]' ORDER BY `path`";
    }

    The sort($files) did not seem to do anything however. I'm not good at array functions but i'll have a look.

    Thanks.
    • CommentAuthorbjl6d
    • CommentTimeMar 20th 2007
     
    Mike, I couldn't get sort($files) to do anything in the plog-import.php file. I put it right beneath
    $files = get_files($config['basedir'] . 'uploads');
    but nothing happens. The import list is still randomly listed.
    • CommentAuthorbjl6d
    • CommentTimeMar 20th 2007
     
    Problem Solved. Added
    sort($tmp);
    after line 83 so it looks like:

    // Finish off the function
    closedir($dir);
    sort($tmp);
    return $tmp;

    under function get_files($directory) {