Hi, how i can automaticaly sort uploaded images by name? Now, it sort randomly, i think.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | imagefield_zip-file_order_repair.471536.20100921.patch | 5.65 KB | dman |
Hi, how i can automaticaly sort uploaded images by name? Now, it sort randomly, i think.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | imagefield_zip-file_order_repair.471536.20100921.patch | 5.65 KB | dman |
Comments
Comment #1
matjes commentedIs there a way to sort the extracted images by name?
Comment #2
pacome commentedHello
thanks for this module, it's pretty usefull !
But I also have this issue..
When I upload a zip containing a serie of pics like "img01 - img02 - img03 ....", they are all sorted randomly..
I think the point of a good image gallery is to be sorted in a certain way.
Then if a bulk upload doesn't sort by name, it only do half the job...
Is there a way to solve that ?
Best
-P-
Comment #3
tike012 commentedChanged category to bug report because I don't think the random sorting is supposed to happen. I've looked at the code but nothing I've tried seems to fix the problem. Will keep trying.
Comment #4
dman commentedYeah, found it.
Turns out that the cck bit that renders the table does not respect either the element order, the delta or the normal #weight settings from FAPI.
Instead it uses its own _weight hidden value and sorts on that.
If you create file fields using the UI, that normally works, but creating the fields though code - as happens here, skips that step.
If _weight is not set, the sorter produces semi-random results, even if your images were nicely names IMG_001, IMG_002, etc
Here's a patch.
Patch also includes some added error handling and logging that I found necessary when debugging. It turned out the code needed a bit of waterproofing against unexpected conditions.
Comment #5
mikeytown2 commentedcommitted the patch. dman let me know if you want CVS; I took over this project because I found it useful.