That's actually a correct sort of those files alphabetically. Obviously not numerically. You could rename the single digit files:
01.jpg, 02.jpg,03.jpg, 09.jpg,10.jpg,11.jpg,20.jpg,21.jpg
And if you have a 100.jpg, use two zeros for the single digit and one zero for the two digit files. Hopefully you don't have a 1000.jpg. But I think you can see how that would affect the number of zeros needed for each of the other filenames.
Or using a text only editor like NotePad you could edit the ddphpalbum.js file replacing:
Code:
if (setting.sortby[0]=="file") //sort by filename (asc)
this.albumvar.images.sort(function(a,b){return a[1].localeCompare(b[1])})
else //sort by date (asc)
this.albumvar.images.sort(function(a,b){return new Date(a[2])-new Date(b[2])})
if (setting.sortby[1]=="desc"){
this.albumvar.images.reverse()
}
with:
Code:
if (setting.sortby[0]=="numeric") //sort numerically by filename (asc)
this.albumvar.images.sort(function(a,b){return +(a[1]).replace(/\D/g, '') - +(b[1]).replace(/\D/g, '');})
else if (setting.sortby[0]=="file") //sort by filename (asc)
this.albumvar.images.sort(function(a,b){return a[1].localeCompare(b[1])})
else //sort by date (asc)
this.albumvar.images.sort(function(a,b){return new Date(a[2])-new Date(b[2])})
if (setting.sortby[1]=="desc"){
this.albumvar.images.reverse()
}
Then you could put here:
Code:
new phpimagealbum({
albumvar: myvacation, //ID of photo album to display (based on getpics.php?id=xxx)
dimensions: [4,6],
sortby: ["numeric", "asc"], //["file" or "date", "asc" or "desc"]
autodesc: "Photo %i", //Auto add a d . . .
Bookmarks