Go Back   Ascended Development forum > Forum > Questions/Support

Questions/Support In need of some help and support? Here's the place.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2009, 21:11
NicoleDY NicoleDY is offline
Member
 
Join Date: Jun 2009
Posts: 5
Default Mini Gallery: Random sorted images

I have downloaded the mini gallery. I have this 'local server' and the images are sorted alphabetically, just how it should be. But when I upload it to my web server, to my website, and cache the images they show up randomly. I didn't change much of the code, especially not the parts that make the albums and images show up. Is it something in the code that's messed up or do you think it has to do with the server I'm uploading it to?

I hope someone can help me.
Reply With Quote
  #2  
Old 09-06-2009, 21:09
allyse allyse is offline
Administrator
 
Join Date: Sep 2006
Location: Oslo, Norway
Posts: 107
Default

Yes, this I can help you with. Actually I dont understand why nobody has said anything about this earlier cause I can see the pictures actually does not sort even in the code.

So to fix this you have to add two small code thingies. If you edited your index.php the line numbers will not match, but you can take a look.

Open index.php and locate about line 379

You will see:

Quote:
...
closedir($dh);
}
}

$countFiles = count($files);
$num = 0;
...
Then add a "sort($files); //Sort images" above the $countFiles like this

Quote:
...
closedir($dh);
}
}

sort($files); //Sort images
$countFiles = count($files);
$num = 0;
...
Just one more now

About line 438 you should see

Quote:
...
closedir($dh);
}
}

$countFiles = count($files);
$key = array_search($pos, $files);

if ($key < $countFiles && $countFiles != 1){ //if not its just one pic in the folder
...
Add another sort here (same code as the previous). The result should look something like this.


Quote:
...
closedir($dh);
}
}

sort($files); //Sort images
$countFiles = count($files);
$key = array_search($pos, $files);

if ($key < $countFiles && $countFiles != 1){ //if not its just one pic in the folder
...
I did not change any code. Do not remove anything, just add the "sort($files); //Sort images" at the places I shown and you are good to go
__________________
With Best Regards,
Aleksander Lyse
allyse AT ascdevel.com

Please support us by donating. Even $5 is appreciated
Reply With Quote
  #3  
Old 10-06-2009, 11:05
NicoleDY NicoleDY is offline
Member
 
Join Date: Jun 2009
Posts: 5
Default

Thanks a lot! I'm going to try this when I get home.
Reply With Quote
  #4  
Old 13-06-2009, 15:12
NicoleDY NicoleDY is offline
Member
 
Join Date: Jun 2009
Posts: 5
Default

Thanks again, that worked like a charm.

I have one final question (for now):

When the gallery shows the album, it chooses a random picture next to the gallery title. If possible I would like to show the first picture in the album or choose an image to show myself. Is there any way to do that?
Reply With Quote
  #5  
Old 14-06-2009, 20:18
allyse allyse is offline
Administrator
 
Join Date: Sep 2006
Location: Oslo, Norway
Posts: 107
Default

Quote:
Originally Posted by NicoleDY View Post
Thanks again, that worked like a charm.

I have one final question (for now):

When the gallery shows the album, it chooses a random picture next to the gallery title. If possible I would like to show the first picture in the album or choose an image to show myself. Is there any way to do that?
Fetching the first picture is kinda easy. In index.php just add a sort.

At about line 339

Quote:
closedir($dh);
}


$countFiles = count($files);

//Caching one picture
add a sort like this

Quote:
closedir($dh);
}

sort($files);
$countFiles = count($files);

//Caching one picture
Choosing your own picture would require to do some more work though, maybe I should make a better version soon with some more options. We'll see, but in the meantime you have to hard program all your custom settings The script is made to be easy, so the script is kinda "stupid"
__________________
With Best Regards,
Aleksander Lyse
allyse AT ascdevel.com

Please support us by donating. Even $5 is appreciated
Reply With Quote
  #6  
Old 14-06-2009, 21:51
NicoleDY NicoleDY is offline
Member
 
Join Date: Jun 2009
Posts: 5
Default

I know it's a simple script and I'm being a bit of a bug ass. But I just want to be able to customise it the best way possible so that my visitors get the real deal. I'm really grateful to you for making such an easy to use script. Coppermine or anything like that just doesn't do it for me. It's hard to customise it so that it fits your own layout.

So, a deep bow for you guys for making this.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 16:52.


Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.