When uploading additional images to a gallery, the position of each new image is inconsistent. Most views will do a sort first by weight, and then by node ID or created date. However, this can be problematic:

  1. Create a gallery and upload photos to it.
  2. Using the Sort Images tab, move the first image to the end of the gallery.
  3. Using the Upload tab, upload new images. Since they will be uploaded with weight = 0, they will be inserted before the last photo.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deviantintegral’s picture

Status: Active » Needs review
FileSize
1.13 KB

Attached is a patch that always sets the weight on new image nodes. This has the effect of storing explicit ordering for photos instead of relying on the node ID.

zengenuity’s picture

Assigned: Unassigned » zengenuity
FileSize
659 bytes

I think this can only happen when you have jQuery UI sorting enabled. (Can you confirm that's what you are using?) The tabledrag interface always makes the weights negative, but the jQuery UI version is using positive numbers. They should be consistent. The attached patch makes the jQuery UI interface use negative numbers like tabledrag does.

Your patch looks like it works, but I think this is a better way to fix the problem.

zengenuity’s picture

Status: Fixed » Closed (fixed)

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