ali mohammad wrote:
Putting image paths in a database would only work if you know beforehand
the path and name of all the images you want displayed (not to mention
the unreasonable overhead of updating that database for additional
images added or existing image files renamed later on). What you would
want, if David’s assumption is correct, is to automatically read the
names of all image files contained in a given path location at the time
of script execution , and then loop through each of the names and
display the appropriate html img tag for each of these images.
IMHO, you could adopt for a simpler approach by using the concept of
<google_for_more_info>directory browsing in php</google_for_more_info>.
The pseudo code of one possible way (among several others) would be
something like this (hopefully assuming you are not stuck in a chrooted
web jail).
The one does not exclude the other. What I used to do in my picture viewer is
go through the dirs, get the paths, and write those to the db (although "new
guy" did not specify if he/she even uses a database, being new to PHP I doubt
it a bit). You can then look at each file and check if you can extract exif
information, at least the image size so that the page build is a bit faster.
I later dropped parsing dir listings as I do not see why I want to dump just a
bunch of files into some spot, I rather have then roughly sorted by year and
month. I now upload a ZIP archive, read the file names into an array, unpack
the archive to a temporary location, then go through the pile of files,
determine if it is indeed an image (oh, still have to write that part), get
some of the exif info, and dump it into the db with a marker set so that I can
later find these images and properly title them, set the rotation, add tags,
and fix the creation date if it wasn't available through exif.
David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php