Posted by Semi Confused on 09/15/07 15:10
Good Morning,
This past week I received a lot of tips on putting together:
<?php
//Open images directory
$dir = opendir("thumbs");
//read files in the dir
while (($file = readdir($dir)) !== false)
//test to make sure jpg
if (eregi("\.jpg",$file))
{
echo "<a href='images/$file'><img src='thumbs/$file'
class=\"pad1em\"></a>";
}
closedir($dir);
?>
Images and thumbs are generated for the same album in iPhoto so
filenames are consistent. One export for thumbs a second for images.
Was reviewing a few of the pages I made and something seemed odd.
Further investigation showed that my thumbs are not in the order of the
filesystem. Here is the source from the output:
<a href='images/DSC01370.jpg'><img src='thumbs/DSC01370.jpg'
class="pad1em"></a><a href='images/DSC01371.jpg'><img
src='thumbs/DSC01371.jpg' class="pad1em"></a><a
href='images/DSC01391.jpg'><img src='thumbs/DSC01391.jpg'
class="pad1em"></a><a href='images/DSC01380.jpg'><img
src='thumbs/DSC01380.jpg' class="pad1em"></a><a
href='images/DSC01382.jpg'><img src='thumbs/DSC01382.jpg'
class="pad1em"></a><a href='images/DSC01412.jpg'><img
src='thumbs/DSC01412.jpg' class="pad1em"></a><a
href='images/DSC01409.jpg'><img src='thumbs/DSC01409.jpg'
class="pad1em"></a><a href='images/DSC01397.jpg'><img
src='thumbs/DSC01397.jpg' class="pad1em"></a><a
href='images/DSC01386.jpg'><img src='thumbs/DSC01386.jpg'
class="pad1em"></a><a href='images/DSC01407.jpg'><img
src='thumbs/DSC01407.jpg' class="pad1em"></a><a
href='images/DSC01396.jpg'><img src='thumbs/DSC01396.jpg'
class="pad1em"></a><a href='images/DSC01410.jpg'><img
src='thumbs/DSC01410.jpg' class="pad1em"></a><a
href='images/DSC01359.jpg'><img src='thumbs/DSC01359.jpg'
class="pad1em"></a>
So it starts at pic 1370 and ends back at 1359. In reality the pics
start at 1359 and end at 1424. Maybe the question is how is the file
system really sorted? Using Filezilla it appears to be ascending by
filename. Date and time of shots are ascending as this is all from the
same "roll".
I haven't tried to implement the other methods shown this week and
maybe one doesn't do this?
or
Readdir into an array?
It's too early for this. :)
Thanks,
Ron
Navigation:
[Reply to this message]
|