Junior Member
Junior Member
wes   2005-09-19, 17:35
#1

I've gotta preface this by saying: thanks, Tristan, for this fantastic program! Even in beta, I like it MUCH better than everything else I've tried.

On to the question:

Per the ZenPhoto web page, I already know that sorting is planned for a future release. Until then, is there a way to manually "force" the sorting of albums on the index page? Such as modifying the album creation date, or something?

Developer
Developer
trisweb   2005-09-19, 20:36
#2

Sort of... the way PHP returns the array of files is based on creation time. So upload in the reverse order you want them (first uploaded files will be last).

There's not really a way to modify this after you've uploaded, so it's not really good for sorting. I'll try to get that in the next version...

Member
Member
kaline   2005-09-28, 02:08
#3

I second this request! Maybe you can make some wacky ajax drag and drop sorting thing-a-ma-bob!

Or, I'd just settle for textboxes for numbers...


-)


Junior Member
Junior Member
cdkrall   2005-09-28, 02:33
#4

Me too.

One idea: Could ZP respect the order the files are numbered in, as in 1.jpg, 2.jpg...etc, or 2003.jpg, 2345, jpg.

If that could be done, one could rearrange them via ftp renaming. For now...

This would make it possible to have a photo that stays at the bottom, 9999999.jpg for example, and one that stays at the top of a gallery.

Developer
Developer
trisweb   2005-09-28, 03:01
#5

Some great sorting interface will be available for 1.0, just not yet ;-)

I know, it's really bugging me too, and that just means it'll be done faster.

Member
Member
loudestnoise   2005-10-07, 23:22
#6

sorting would be amaaazing. doesn't even have to be AJAX, just anything.

Junior Member
Junior Member
jabo   2005-11-21, 17:46
#7

php has a number of bult in functions for sorting arrays. so for instance if you wanted to sort your images alphabetically you could add a line like sort($images); to the get_image function

Member
Member
Luckyspin   2005-11-27, 00:05
#8

Yeah, natcasesort is probably a better bet. Stick this in at line 311 of classes.php:

natcasesort($images);

This'll give you basic natural alphabetical sorting, which works pretty well for most image names. Especially if you have just pulled them off a digital camera.

Member
Member
andrea   2005-12-01, 07:58
#9

adding natcasesort($images); worked great for sorting the images, but it did something weird where some pictures would be skipped when i would go through an album from one picture to another, so i had to take it back out for now. any idea why that happened?

Member
Member
Luckyspin   2005-12-01, 21:51
#10

Yeah, I noticed that too. The natcasesort fix works for the Albums view, but the next/prev links don't work correctly. I'll look into it.

Developer
Developer
trisweb   2005-12-02, 09:11
#11

It may be the indexing in the array... it's pretty hacky how it's done, but essentially, the entire album is an array which is loaded each time, and the next/prev just use the index of the current in that array. So make sure it's always sorted the same way I guess.

Member
Member
Luckyspin   2005-12-07, 07:58
#12

Yeah, that was it. Since we're using the numerical index of the array to get the next/prev images, we need to store the new array values, without the previous keys. So, after the while loop in getImages, insert this:

natcasesort($images);

        // Store the result so we don't have to traverse the dir again.
        $this->images = array_values($images);

Note: the last line replaces the previous storing of the array. That'll solve the next/prev links problem.

Member
Member
andrea   2005-12-07, 16:43
#13

excellent! works perfectly. thanks.

Member
Member
mattscape   2005-12-19, 22:27
#14

well it doesn't work for me.
i added the following lines:

natcasesort($images);
//$this->images = $images;
$this->images = array_values($images);

but the albums on the index pages are still in an order i can't recall

Member
Member
Luckyspin   2005-12-20, 08:14
#15

This fix was only to sort the images in an album, NOT the albums in the main index page of the Gallery.

Member
Member
mattscape   2005-12-20, 15:43
#16

well how does zenphoto sort the index page?
and is there a way to change this?

Member
Member
Luckyspin   2005-12-22, 02:43
#17

Check out my post in the Status topic for some good news on manual sorting!

http://www.zenphoto.org/support/topic.php?id=138

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.