Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   phphq.Net Forums (https://novahq.net/forum/forumdisplay.php?f=277)
-   -   what is the order of the albums and pictures? (https://novahq.net/forum/showthread.php?t=40191)

pinkish 12-04-2007 01:21 PM

what is the order of the albums and pictures?
 
Hi,

I've installed and customized phAlbum (i am pretty good with HTML). The only thing I don't know how to do is to put the albums in a certain order.

I've tried renaming them:
01.Pics_blabla
02.Bla

but it doesn't seem to work.

What I can see is that the order in which the folders/images are picked up is NOT random, because it is the SAME order on every computer I've loaded it.

The question is: the order in which phAlbum reads and displays all the files and folders is based on what exactly?

Thank you!

Scott 12-04-2007 08:11 PM

To be honest, there is no exact order. To put the files in order you will have to change the code.... look for this bit of code (Starts near line 514):

PHP Code:

//Lets get some images!!

$dir=@opendir($full_server.$album);

//Loop through them all ;).

while($file=@readdir($dir)) { 

and replace it with this:

PHP Code:

//Lets get some images!!
$dir $full_server.$album.'*';

//Loop through them all ;).

foreach(glob($dir) as $file){
    
$file substr($filestrlen($dir)-1); 

That should order them alphabetically.

pinkish 12-05-2007 02:56 AM

Hey, man! I would like to thank you for your reply! It's absolutely fantastic for me to be able to use this software!

Again, thanx for the code!

pinkish 12-05-2007 03:07 AM

Based on your script, I can arrange them in any order, by doing this:

PHP Code:

$find=array("_","0","1","2","3","4","5","6","7","8","9");
$replace=array(" "," "," "," "," "," "," "," "," "," "," "); 

and then naming the folders like this:

0899_Folder_I_want_first
0900_Second_folder
0901_3rd_folder

I know it's a newbie thing but it works like a charm!

PS: i've also removed the code for the trailing directories, cos i didn't want that and they looked ugly with all the numbers :)

Pirata 01-19-2008 04:06 PM

Hey Scott, I tried your code but it doesn't work. When I want to view my photos or directories, I always get the same error: "No images to display in this album. Please pick another album."
Do you got any solution for this or do you have any other code that should work?

Thanks!

Pirata

mushy 03-05-2008 04:34 PM

Quote:

Originally posted by pinkish
[B]Based on your script, I can arrange them in any order, by doing this:

PHP Code:

$find=array("_","0","1","2","3","4","5","6","7","8","9");
$replace=array(" "," "," "," "," "," "," "," "," "," "," "); 


This is cool for the folder names and images names. But the folder navigation at top doesn't replace it (i.e. .ucwords($folder[$i]). remain unaffected).


Can someone will help me with that please?

merc07 10-26-2013 07:45 AM

Is there a simple way to reverse the order so it will display the most recent images first when the file name is the image date / time ?

Thanks
Adam


Quote:

Originally Posted by Scott (Post 317215)
To be honest, there is no exact order. To put the files in order you will have to change the code.... look for this bit of code (Starts near line 514):

PHP Code:

//Lets get some images!!

$dir=@opendir($full_server.$album);

//Loop through them all ;).

while($file=@readdir($dir)) { 

and replace it with this:

PHP Code:

//Lets get some images!!
$dir $full_server.$album.'*';

//Loop through them all ;).

foreach(glob($dir) as $file){
    
$file substr($filestrlen($dir)-1); 

That should order them alphabetically.


merc07 10-26-2013 08:21 AM

Sorted it using rsort..

//Lets get some images!!
$dir = $full_server.$album.'*';
//Loop through them all ;).
$all_files = (glob($dir));
rsort($all_files);
foreach($all_files as $file){

Thanks
Adam


Quote:

Originally Posted by Scott (Post 317215)
To be honest, there is no exact order. To put the files in order you will have to change the code.... look for this bit of code (Starts near line 514):

PHP Code:

//Lets get some images!!

$dir=@opendir($full_server.$album);

//Loop through them all ;).

while($file=@readdir($dir)) { 

and replace it with this:

PHP Code:

//Lets get some images!!
$dir $full_server.$album.'*';

//Loop through them all ;).

foreach(glob($dir) as $file){
    
$file substr($filestrlen($dir)-1); 

That should order them alphabetically.



All times are GMT -5. The time now is 12:49 AM.

Powered by vBulletin®