Usually what i do is, when i upload a photo i store the filename (eg picture.jpg), and some other details about the picture in a table (eg tblPictures). In this table i also have an extra column "order_id", which i use for sorting the images in the table.
So, assuming you have a similar table, you will now need an interface from which you can alter the photo order. In this instance i usually have 2 links Up & Down, Up increments the photo position(ie incrementing the order_id) & Down does the opposite(decrementing the order_id).
So, once this is done, when you now retrieve the photos ensure you order them by order_id ASC or DESC. Then incorporate the code you have above.
I hope this points you in the right direction.
wilch
Junior Poster in Training
84 posts since Aug 2007
Reputation Points: 25
Solved Threads: 17
$files = sort(glob('photos/*.jpg'));
foreach ($files as $file) {
$photos .= '<img src="thumbs.php?src='.$file.'&f=2&t=3" alt="'.$file.'" title="'.$file.'"/>';
}
pritaeas
Posting Expert
5,484 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875