By mensch on
Hello,
can anybody tell me, how to change the sort order for images in my image gallery. At the moment the images are not sorted by names but by import date. The image which was imported last is in front and vice versa. I thought, views would be an usefull module, but it is not compatibe with version 6 of drupal.
I already searched with google, without success.
Thanks for help,
Greetings from Bielefeld in Germany
Comments
an approach for 5.7
i'm not sure what's possible for sorting image galleries under 6.x, as i haven't looked 6 yet, but here's the approach that i have used in 5.7. though it's not a good idea to use the theme system for logic like sorting, that's where i put my sort code, because it was simplest to implement, and because on the sites i've used this on, i know one theme will be used for all users at all times. still, it's not best practice.
i placed the following into the theme's template.php file. in this example the theme is named "yourtheme" - you would replace that with the name of the theme you're using.
to get the sort ordering you want, customize the comparisons in imageCompare(). this example should sort images alphabetically by name, while keeping sticky nodes at the top.
Thank You! It works fine!
Thank You!
It works fine!
(5.x-1.9)
Change sort order for images in gallery
Assuming you have the basic Image module installed, as well as the 'Image Gallery' module that comes packaged with it, via the navigation menu, go to
Administer >> Site configuration >> Images
and click on the "Image gallery" tab. Under "Image Display Sort Order" choose an option that suits your needs.
Trying to get image order right
Ok, I need some real basic help with this one. I have 5.7 and don't see the "Image Gallery Tab". My site developer has bugged out and I am very very slowly learning my way around.....I'm a stonemason not a website developer!. I'd just like to get my images in order.
Edit Image Gallery Module
Neither of these approaches worked for me unfortunately. The latest image 1.x module doesn't have the sort capability, and the 2.x module has so many changes (integration with views) that it completely loses my galleries.
I know this is a hack, but for lack of time and because I don't plan on upgrading the image gallery module, here's how I changed the sort order - in image_gallery.module, simply edit lines 149 and 157, and change ... ORDER BY ... n.created DESC -> n.created ASC. You could also replace n.created with n.title or however you want to sort.