1) Script Title: PHP Photo Album script v2.11
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...photoalbum.htm
3) Describe problem: What should I change to get the script to sort by filename and be case insensitive?
1) Script Title: PHP Photo Album script v2.11
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...photoalbum.htm
3) Describe problem: What should I change to get the script to sort by filename and be case insensitive?
Last edited by james438; 12-07-2009 at 03:32 AM.
To choose the lesser of two evils is still to choose evil. My personal site
It already does.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Laintest.JPG is listed right before akira.jpg. I am pretty sure this is because it is case sensitive.
To choose the lesser of two evils is still to choose evil. My personal site
Well, I tested the method used and it was case insensitive here. However, if you are having problems, replace:
with:Code:if (setting.sortby[0]=="file") //sort by filename (asc) this.albumvar.images.sort(function(a,b){return a[1].localeCompare(b[1])})
Are you sure you are sorting byCode:if (setting.sortby[0]=="file") //sort by filename (asc) this.albumvar.images.sort(function(a, b){return a[1].toLowerCase() > b[1].toLowerCase();})['file', 'asc']and have made no changes to getalbumpics.php?
Code:new phpimagealbum({ albumvar: myvacation, //ID of photo album to display (based on getpics.php?id=xxx) dimensions: [3,2],sortby: ["file", "asc"], //["file" or "date", "asc" or "desc"]autodesc: "Photo %i", //Auto add a description beneath each picture? (use keyword %i for image position, %d for image date) showsourceorder: true, //Show source order of each picture? (helpful during set up stage) onphotoclick:function(thumbref, thumbindex, thumbfilename){ thumbnailviewer.loadimage(thumbref.src, "fit2screen") } })
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
james438 (12-02-2009)
That worked.
I did make a few changes prior to starting this thread.
I usedafterCode:desc=(desc.indexOf('%filename')!=-1)? '<br />/images/' + albumvar.images[i][1] : desc
and when I updated from 2.0 to 2.11 I only updated the ddphpalbum.js file. Maybe it was a problem with my php.ini?Code:var desc=(desc && desc!="")? '<br />' + desc.replace(/(%i)|(%d)|(%s)/g, function(m){ return (m=="%i")? i+1 : (m=="%d")? albumvar.images[i][2] : "" }) : ''
Last edited by james438; 12-02-2009 at 07:19 PM. Reason: grammar
To choose the lesser of two evils is still to choose evil. My personal site
I did a little more research on this localeCompare() method used by the script. It is non-standard, varies by those browsers that do support it, as well as by what the language (English, German, French, etc.) is in effect on the local computer.
So it may be nothing you did to your PHP or script code.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Yes. When I tested the script in Opera, Firefox, and IE8 only Opera sorted in a case sensitive manner.
To choose the lesser of two evils is still to choose evil. My personal site
Odd. I looked again and your fix did not work and it is still an Opera problem. Opera puts the order of results as:
I seem to be having a number of issues with the Opera browser lately.PHP Code:/images/alita5.jpg
/images/akira.jpg
/images/alita1.jpg
/images/alita2.jpg
/images/alita3.jpg
/images/alita4.jpg
/images/alita6.jpg
To choose the lesser of two evils is still to choose evil. My personal site
By coincidence Opera is my primary browser for surfing the web, although Firefox is configured on my system as the primary browser - available as the default for preview of any web page in my editor or double clicked in my windows explorer (different than internet explorer). I like Firefox for this due to its superior IMO diagnostics of both javascript and HTML code.
Anyways, as a confirmed Opera user, I also use it and its excellent AI for email. At the same time though I am aware of its many quirks as regards, well just about everything. I think most Opera users are aware of this as well, and accept it as a trade off for the added security and features Opera provides.
One consolation though, as regards this script, because the image array produced still carries with it its original index at the time it was fetched from the image folder, most things you do with the images will still 'work out', regardless of what order your sorting algorithm places them in.
Is there any particular problem that arises from Opera's different take on the sort? If so, there is almost certainly a workaround, though it may or may not not be simple.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
I'm thinking about this a bit more. If you want you can give me a link to your page and I'll see if I can figure an Opera fix. In the mean time I'll do some tests to see if I can get Opera to duplicate the behavior you are reporting.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks