View Full Version : PHP Photo Album script
alisonlau888
06-21-2006, 10:20 AM
The script that I'm using is:
http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm
Now that I would wonder if I can use the file name of the image to replace "photo 1, photo 2... etc."?
For example, I have photos with file name "apple.jpg", "orange.jpg" & "banana.jpg".
I would like the description under the photo to be "apple", "orange" & "banana"; instead of "photo 1", "photo 2"...etc.
Thanks a lot!
jr_yeo
06-21-2006, 12:55 PM
change
tempcontainer+=(descriptionprefix[0]==1)? descriptionprefix[1]+(i+1) : ""
with
tempcontainer+=galleryarray[i][0].replace(/\..*$/, '')
alisonlau888
06-28-2006, 03:14 AM
Thank you very much, it works.
Now I have installed and got it displayed decently.
And I know in order to display the photo alphabetically, I can add this:
galleryarray.sort()
What if I want to display from the last to the beginning?
For example I have A.jpg, B.jpg, C.jpg... etc.
But I want to display from Z.jpg back to A.jpg?
Thank you very much!
jscheuer1
06-28-2006, 05:09 AM
function sortascend(a, b){ //Sort images function
if (a[0].toUpperCase()<b[0].toUpperCase())
return 1
else if (a[0].toUpperCase()>b[0].toUpperCase())
return -1
return 0
}
galleryarray.sort(sortascend);
alisonlau888
06-30-2006, 07:44 AM
function sortascend(a, b){ //Sort images function
if (a[0].toUpperCase()<b[0].toUpperCase())
return 1
else if (a[0].toUpperCase()>b[0].toUpperCase())
return -1
return 0
}
galleryarray.sort(sortascend);
Thanks...
But where should I put the above script?
jscheuer1
06-30-2006, 07:46 AM
Just substitute it for:
galleryarray.sort()
wherever you had that.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.