I think this feature is one of the most useful and also one of the easiest to implement: sorting by date. In a gallery, it'd be much nicer to have recent pictures upto the top - especially you don't devide images in lots of images (no 'per event' galleries).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

myadidas’s picture

Title: Sort by date » set thumbnail order

I would think there should be some way to arrange the thumbnails after you've uploaded each picture. Something along the lines of the weight feature but for each gallery (although you would need to increase the bounded integer combo box for large galleries).

Bèr Kessels’s picture

Have a look at zhazamgallery [1] (beware: alpha), There is no weigting and ordering system yet, but that is in the pipeline. Probably in the next two weeks will I start with that. With some help, i want to get [2] an AJAX ordering system in.

What you request is indeed not possible. Nor is it, IMO agood feature
for this module. I,age module should be clean above everything else,
IMO.

[1]http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/ber/shazamgal...
[2]http://tool-man.org/examples/edit-in-place.html (Slideshow Sorter)

dmjossel’s picture

How can this not be a good feature for the module? I really cannot possibly understand this. My use of the 4.5 image module practically depended on being able to order thumbnails within a gallery, and to specify which image from a gallery was presented as the thumbnail representing that gallery.

The old module let you choose first, last, or random.

The new module chooses... well, something-- I've no idea how, and there's no way to change it, and no indication from the CHANGELOG about this feature being removed.

I can't even begin to list the number of times where a client has asked for images to be reordered in this way, and now there's simply no way to do it?

Bèr Kessels’s picture

You did not understand my comment, I fear.
Things like ordering by Foo, by Bar, by user, date, size, popularity etcetc do NOT belong in the simple basic image handling, but in an advanced gallery.
where do we start? sort by date, where do we end? Sort by amount of red pixels? That is y point. You maywant to sort by foo, other by bar, yet others by fooBars etc. Again: this belongs in an advanced gallery module.

freyquency’s picture

I believe the gallery module should display one way: chronologically. When one clicks on the gallery of their choice it should show first->last. That would be the most logical way of displaying images that belong together.

underpressure’s picture

Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev

Any update?

I'm using 4.7 and would like uploaded pictures to be sorted by oldest first.

I recently took pictures of a funeral and I had to explain to many why pictures of the burial came before pictures of the church service.

drewish’s picture

Version: 4.7.x-1.x-dev » 5.x-1.x-dev
Component: image.module » image_gallery

marked http://drupal.org/node/107160 as a duplicate

drewish’s picture

marked http://drupal.org/node/147846 as a dulicate

drewish’s picture

marked http://drupal.org/node/179788 as a duplicate

underpressure’s picture

I take a lot of photos at Parties and concerts and have the same issue with sort order, You see photos of people going home at 3am before seeing photos of the party starting or the ending of a concert before the pre-show photos.

Beyond chronological order I think the other sort order should be in import.module since it is way for mass import with the image module. It will set the order in which images are imported/nodes created.

Anyone agree?

WeRockYourWeb.com’s picture

I've been playing around trying to find the most practical, easy-for-clients-to-use image gallery in Drupal, and have played with acidfree; gallery2 embedded; flash gallery; cck image, views, thickbox combo; but finally settled on the standard image module + gallery + mass import. I would also love to see this feature. As soon as I find extra time I'll see how difficult it might be to implement this.

betonarbejder’s picture

Assigned: praseodym » betonarbejder

I agree. Could really use some sorting feature. Just by date, filename or something of that kind

odysseus-1’s picture

Seeing as mine got marked duplicate I'll put my suggestion here. Currently the galleries defaults to ordered descending by nid, please give us a config option to choose ordered ascending by nid. It's not exactly hard, and doesn't fall into advanced functionality, it's about as basic as you can get. Options for ordered ascending/descending by title would be good too. Yes, this would only be at a global level, not at gallery level, but it's a start until someone comes up with a decent gallery module that includes weightings.

sander_123’s picture

installing weight.module, configuring only that it sets weight to image nodes is a solution!

(edit: it didn't actually.. i had to change the sort order in line 717 of image.module as well)

joachim’s picture

I've made a patch that adds a Gallery view-type to the Views module, so you can create a gallery and sort it any way you like: http://drupal.org/node/134423

dman’s picture

Status: Active » Needs review
FileSize
3.38 KB
15.91 KB

Seeing as the duplicates are pointing here, I'll post my new patch (which I desired, needed, and came up with on my own) here as a possible solution.

I know that to go too much further into this sorta feature should be shifted into views or other 'advanced' configurations, but I like the simplicity of image_gallery and yes, this is a really really obvious request.
I was trying to demo to a client how easy it was to use image_import and just add a folder, and he just asked why they were all backwards! It was just so blindingly unintuative that I had to apologise to him, after convincing and lecturing to him on the importance of good file naming conventions...

The reverse chronological timestamp default makes sense in news sites, but sure doesn't with numbered or dated picture series.

SO anyway.

Here's the fix.

(Yes, I caught the typo after making the screenshot :)

Feel free to tell me that there's better ways of doing my SQL.

Hetta’s picture

I run 5.x-2.x-dev, so I added dman's patch (#16) to the image_gallery.module and ran it. Works a treat, but eh, doesn't sort by title, so I added that functionality. Please somebody give it a test run on their 5.x-2.x-dev install ...

Lovely patch, dman!

dman’s picture

Yeah, I was thinking of doing titles as well, pretty easy, but, um, check the timestamp on that post. :-B

You don't need all that SQL of mine there if you just want title, it's already there in the normal lookup.

        case IMAGE_GALLERY_SORT_TITLE :
          $query = "
            SELECT n.nid FROM term_node t
            INNER JOIN node n ON t.nid=n.nid
            INNER JOIN files f ON n.nid=f.nid
            WHERE n.status=1 AND n.type='image' AND t.tid=%d AND f.filename='". IMAGE_ORIGINAL ."'
            ORDER BY n.title ASC
          ";

Just go

        case IMAGE_GALLERY_SORT_TITLE :
          $order = 'ORDER BY n.sticky DESC, n.title ASC';
           break;
Hetta’s picture

OK, updated patch for 5.x-2.x-dev attached. It works a treat over here.

Thanks dman!

Hetta’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
FileSize
3.13 KB

OK, here's the dman's patch (plus sort by title) for 6.x, please test - it works a treat on my install.
(cos of this comment by drewish: http://drupal.org/node/232557#comment-764746 )

dman’s picture

Status: Needs review » Reviewed & tested by the community

Any objection to rolling this into production folks? Please?
It's wanted in 5, works, and looks good in 6.

As above, I know that the views hooks are the big, sexy way to do this, but image_gallery is deliberately lightweight and simple and this option is at the right level for many user who want to use it.

lindsayo’s picture

This broke my galleries.

What did I do wrong?

user warning: Unknown column 'f.nid' in 'on clause' query: SELECT n.nid FROM term_node t INNER JOIN node n ON t.nid=n.nid INNER JOIN files f ON n.nid=f.nid WHERE n.status=1 AND n.type='image' AND t.tid=1 AND f.filename='_original' ORDER BY n.sticky DESC, f.filepath LIMIT 0, 6 in /home/gto/public_html/modules/image/contrib/image_gallery/image_gallery.module on line 184.

This line actually starts at 172.

I am running Drupal 6.1

dman’s picture

Sorry, I haven't personally tried it with 6. Can only vouch for 5.
I'm thinking D6 went for file revisions, rather than just node ids. Anyone?

rwohleb’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
3.4 KB

Hetta's patch is broken, at least on D6.1. It references files.nid, which doesn't exist. Here is a patch that seems to work.

dman’s picture

just a note (I'm not on a dev site today)

- SELECT n.nid FROM term_node t
+ SELECT n.nid FROM {term_node} t
andypost’s picture

- Fixed {tables}
- Added translation t() to $options

jarintrn’s picture

Thank you very much, had the same problem.

trefor’s picture

Title: set thumbnail order » cant upload images

I have the dev snapshot of image and every time i want to upload and image i get the following errors

# warning: Division by zero in /home/sites/mysite.co.uk/public_html/includes/image.inc on line 160.
# Unable to create scaled Thumbnail image
# The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

is this due to the module not being finished?

Thanks

Hetta’s picture

Title: cant upload images » set thumbnail order

Please don't hijack existing issues. Read the issue queue for various solutions to your problem, and if none of them work, create a new issue.

Thanks.

drewish’s picture

i'm not sure about the queries that have order by fields that aren't in the select... i seem to remember pgsql not liking that...

Hetta’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #26 works on my D6 install without breaking things - and this time I tested all four sorting options.

trefor’s picture

Hetta.. apologies. new here.

Brian@brianpuccio.net’s picture

Couldn't this just be done with views?

dman’s picture

Disclaimer re views above, twice, in this thread.

5 lines of code vs 15000
A UI that just works rather than one that takes half a day to learn.
Simply, Views is cool, but a behemoth of a plugin to require when someone wants to add a list of images to their blog.

By the rationale of "Just use views", image_gallery.module itself would be totally redundant. I don't think it is, but a small improvement has been requested several times in history..

+1 Current patch #26 for me

dman’s picture

Bump?
Ready to roll? Backport to 5? (It looks identical to me)

... although I can't see what the INNER JOIN {image} i ON n.nid=i.nid achieves?

Hetta’s picture

Agreed with #34 - views is pretty, but on heavy duty sites it's too much. (I'm on a shared webhost, and my drupal install grabs 25+% (really) of the available CPU, with frequent core dumps).

So the fewer modules the better. Could we get this easy fix into image_gallery please?

Thanks!

drewish’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
4.36 KB

looking pretty good. i made a few changes:
- cleaned up some coding standards issues.
- added a del_variable() to the hook_uninstall() implementation.
- reworked the way the query in image_gallery_page() is built so that we use the proper placeholders.
- renamed the constants to make them more consistent.
- i also found the sort setting names to be a bit confusing and renamed them.

if i can get a review to double check that i didn't break anything then i'll commit this and we can back port to 5.x-2.x. also, do the new sort settings names make sense?

dman’s picture

Status: Needs review » Reviewed & tested by the community

Yipee!
Now that's a whole lotta love for this thing. Thanks for the professional once-over drewish!

Right. I tried it on a fresh D6. Goes exactly as planned.

Something needs to be changed for a D5 backport patch though. What's this 'image' table?
Some of us are still the D5 userbase at the moment :-)

Hetta’s picture

The patch works a treat on D6, and I cycled through all 4 sorting options.
Eh, dman, "image" comes with 5.x-2.x-dev :-)

drewish’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Thanks everyone, committed to HEAD (aka 6.x-1.x). Needs to be backported to 5.x-2.x now.

dman’s picture

Um yeah, I discovered image 5--2 today :-?

drewish’s picture

Version: 6.x-1.x-dev » 5.x-2.x-dev
dman’s picture

Like this?
Seems OK to me on 5--2 now.

drewish’s picture

Status: Patch (to be ported) » Fixed

looks good to me, let the bug reports roll in ;)

thanks, committed to DRUPAL-5--2.

underpressure’s picture

Will 5.x-2.x be out of dev anytime soon? I really want to use thumbnail order.

drewish’s picture

i guess i could post an -alpha1 release... to get some feedback

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.