I was wondering if someone could help me - basically I had some code which worked fine on another server, but on my new eukhost server is performing well somewhat odd.
Basically I am using the readdir() function to read in thumbnailed images and the link to their full sized counterparts.
A simple enough procedure, and on the old server it would do this fine, it would read them alphanumerically from the lowest to highest, however on this new server it is reading them in some bizarre order that I can't really work out.
Is there any way to force the code to read a certain way? (I couldn't find such a parameter) or is there anything else I could do?
I suppose if all else fails, I fire everything into an array, sort the array and then output the results, but I really don't want to have to do that if it can be avoided.
Here is the code I am using...
PHP Code:
$j = 0;
$gall = $_GET['gall'];
$test = "/home/simplyti/public_html/members/i/$gall/";
$dir = opendir($test);
while ($file = readdir($dir))
{
if ($file != "." && $file != ".." && $file !="index.php")
{
if(eregi("t[.]jpg", $file))
{
$limage = explode("t.", $file);
$linkimage = "$limage[0].$limage[1]";
if ($j==3)
{
print "<tr>";
$j = 0;
}
print"<td><div align='center'><a href='http://www.simplytied.com/members/i/$gall/$linkimage' target='_new'><img src='http://www.simplytied.com/members/i/$gall/$file' border='0' /></a></div><td>";
$j++;
}
}
}
closedir($dir);
Any help would be greatly appreciated!