Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I noticed that when I use autosort, the pictures are sorted from newest to oldest.
I'm not sure if it's by design, but I kind of like that if i click the picture it goes from oldest to newest (by date). So if someone needs it quick, I'll just upload the patch here.
Comment | File | Size | Author |
---|---|---|---|
#2 | prog_gallery-autosorting.diff | 656 bytes | shemgp |
prog_gallery-asc_sort.diff | 428 bytes | shemgp |
Comments
Comment #1
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commentedthis one is gonna be a bit smarter, it will be ascended on first click and descended on second one.
Comment #2
shemgp CreditAttribution: shemgp commentedHow about this one? I'm not sure if this is the proper way of doing it.
Comment #3
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commentedgood, I just modified it a bit, so that session variables are used instead (because variable_set/get is stored in database for shared use between all users).
And it looks like this now:
based on this, "Autosort" button finally got it`s icon ;)
Comment #4
manoloka CreditAttribution: manoloka commentedIs this supposed to be implemented already?
Comment #5
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commentedit is, and was commited into cvs 9 seconds ago :)
Comment #6
shemgp CreditAttribution: shemgp commentedI just noticed that if i use array_multisort it doesn't sort or pictures without exif data. So, when i click the autosort button again, it doesn't reverse the order of the pictures that doesn't have exif data. Although, it still places the whole group of unsorted pictures in front or at the end of the exif sorted pictures.
example, using array_multisort only (where u = unsorted, e = exif sorted):
asc:
u3 u2 u1 e1 e2 e3
desc:
e3 e2 e1 u3 u2 u1
where when using array_reverse after array_multisort
asc:
u3 u2 u1 e1 e2 e3
desc:
e3 e2 e1 u1 u2 u3
I kind of liked it to reverse the order of pictures if i click it, but i'm not really sure what the intent of autosort is. Should it be by date only and if there's no, date ignore it?
Comment #7
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commentedwhat parameter is using array_reverse to sort uX ? Is there any other really usable field to sort images? It could be title.. but then again - why, and would it be practical? could it be body? but then again - why, and would it be practical again? :)
What do you think? Photo galleries are for photos, usually they have the most pictures and they have exif data. I guess this is as far as I can really help with this feature.
I`d like to review benefits using array_reverse tho`.
Comment #8
shemgp CreditAttribution: shemgp commentedYup, i realized that too =). I guess if the design of the autosort is that when it's clicked the second time the order of how the pictures are currently sorted will be reverse, then maybe array_reverse should be used. Because it reverses it even if the pictures don't have exif.
Comment #9
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commentedthats really good point.
update: now it looks like this
and it`s uploaded into cvs ;) Friend of mine said that they could be sorted by title when its like IMG_1022.JPG.. but then again - those pictures have exif date in header anyway.
Comment #10
Jānis Bebrītis CreditAttribution: Jānis Bebrītis commented