Closed (fixed)
Project:
Node Gallery
Version:
6.x-2.0-alpha11
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2009 at 00:09 UTC
Updated:
29 Dec 2009 at 22:48 UTC
The current sorting feature of this module works fine, but when a user has a muti-page gallery with too many pictures it would be better if the new images uploaded to the gallery were positioned on top of it by default, instead of in the last position, so users don't need to go trough the whole gallery to see the new pictures.
Is this possible with the standard functionality of this module? If it's not, what can I do?
Thanks in advance.
Comments
Comment #1
Hau commentedI was wondering, if I need to make a patch for this, should I simply search for the lowest weight from the images in the gallery the current image is being uploaded, and save the uploaded image with that weight less 1?
Comment #2
Hau commentedSomehow I made it. In the function node_gallery_image_save() (from the file node_gallery.inc) I added this line in the insert part of the function (about line 250):
$image_node->weight += - 1 + db_result(db_query("SELECT weight FROM `node_galleries` WHERE gid = %d ORDER by weight limit 1", $image_node->gid));
It's working fine so far, the only problem is when I upload multiple files at once. In that case I would like to have the images sorted as I leave them in the sorting page, but they show in reverse order.
I assume the upload function I modified is being called multiple times when I upload multiple files, and each time the weight is decreased by 1. I don't know how to solve it, probably I can try uploading the files in reverse order but I can't figure out how to do that.
EDIT: Fixed
Comment #3
Hau commented