Sort by album name

hidden

Joined: 2002-08-16
Posts: 4
Posted: Fri, 2002-08-16 05:21

First i would like to say that i'm happy you created a forum. It's much better than the mailing list.

I would like some help in cusomizing my gallery. I want to have the albums sorted in alphabeticly order. How would i do that ?

Also is there any possibility to limit 5 pictures per album ?

Any help would be appriciated.
Thanks

 
tSlater

Joined: 2002-08-17
Posts: 8
Posted: Sat, 2002-08-17 14:13

I think there is a link somewhere near the top called [sort] which you can lick.. and then choose "Sort Alphabetically" and click on the botton.. I think that should work.. unless it is only available inside albums or something.. I would check, but I can't onnect to the server I have my gallery on.. (strange, it was up just a minute ago..)

 
hidden

Joined: 2002-08-16
Posts: 4
Posted: Sat, 2002-08-17 16:17

Yeah that's only for sorting the pictures for inside the album by name. I tried to modify that code so it would work for album name but didn't have any success. That's why i'm asking for your help :smile:

 
Rick

Joined: 2002-08-20
Posts: 5
Posted: Fri, 2002-08-23 11:08
Quote:
Yeah that's only for sorting the pictures for inside the album by name. I tried to modify that code so it would work for album name but didn't have any success. That's why i'm asking for your help :smile:

I know this isn't exactly what you wanted, but if you click [MOVE ALBUM] you can specify what position it takes in the listing (ie 1 is at the top etc)

 
hidden

Joined: 2002-08-16
Posts: 4
Posted: Fri, 2002-08-23 18:52

Yeah i noticed that. And that's what i did. It took me about 1 hour because i had more than 200 albums to sort :smile: Thanks for advice.

 
copland007

Joined: 2002-08-07
Posts: 10
Posted: Tue, 2002-12-17 19:54

Bringing this thread back from the grave :smile:

I too just went through the manual process of moving albums around.

Has anybody worked on any code to help automate this process?

 
Pryce

Joined: 2003-01-13
Posts: 1
Posted: Mon, 2003-01-13 03:15

I was hoping someone had done this but after searching for HOURS, i figured it'd be easier to do it myself. :grin:

This works for me.

Open Albums.php and at line 279 you should have:

} else if (!strcmp($sort, "caption")) {
// sort album alphabetically by caption
$func = "$objA = (object)$a; $objB = (object)$b; ";
$func .= " $captionA = $objA->getCaption(); ";
$func .= " $captionB = $objB->getCaption(); ";
if (!$order) {
$func .= "return (strcmp($captionA, $captionB)); ";
} else {
$func .= "return (strcmp($captionB, $captionA)); ";
}

Replace it with:

} else if (!strcmp($sort, "caption")) {
// sort album alphabetically by caption
$func = "$objA = (object)$a; $objB = (object)$b; ";
$func .= "if ($objA->isAlbumName) { ";
$func .= " $captionA = $objA->isAlbumName; ";
$func .= "} else { ";
$func .= " $captionA = $objA->getCaption(); ";
$func .= "} ";
$func .= "if ($objB->isAlbumName) { ";
$func .= " $captionB = $objB->isAlbumName; ";
$func .= "} else { ";
$func .= " $captionB = $objB->getCaption(); ";
$func .= "} ";
if (!$order) {
$func .= "return (strcasecmp($captionA, $captionB)); ";
} else {
$func .= "return (strcasecmp($captionB, $captionA)); ";
}

It now looks at the albums name and the pictures caption. The compare is now case insensitive too.

!!!Important!!! This forum strips off 's. Before most $ there should be a ...look at your current code and replace as needed.

 
headhunter

Joined: 2003-01-13
Posts: 75
Posted: Mon, 2003-01-13 05:02

Coo... tried the code but... just curious do you need to hit the sort button to activate this?

 
headhunter

Joined: 2003-01-13
Posts: 75
Posted: Sun, 2003-01-19 04:16

Does this only work if your importing the filez, have tried this fix but it doesn't seem to work.

Just curious also about the program itself(is there a way to disable the order that images and folders are displayed and have them ordered by alphabetical(folders above images?)

 
hpthorn

Joined: 2002-08-09
Posts: 2
Posted: Sun, 2003-01-19 21:10

Try the "Sort by filename" option in the sort album window. Just remember to "rename" your albums first.

 
headhunter

Joined: 2003-01-13
Posts: 75
Posted: Sun, 2003-01-19 21:33

ah... figured it was something like that...

So it's not possible to change some of the original script so it ignores which folder should be first and do everything alphabetically?