Culling URL entries from an image folder into MySQL
Posted: Tue Feb 04, 2003 12:48 pm
It may turn out I have not designed my database the right way - please let me know if you think so. ten days ago I had never touched PHP or MySQL in my life.
On my site (http://www.flyingchair.net) I have a photo section. There are two databases. One database is an index of picture stories, each story with a unique key, the second is a database of pictures, each picture having a unique key AND having the story key that identifies which bacth of pictures it belongs to. This is so I can go from a master photo page, to a details story page with the thumbnails and then to a picture page. I use JOIN USING to get the two tables to work together so I can fill in information from both databases on the same page.
My problem is this. Each picture has a name xyz.jpg for the main picture and xyz_th.jpg for the thumb (batched in Fireworks). The entry for in the database is the name of the file which is then parsed by PHP into the HREF statement (ie HREF="images/<?PHP $ etc. ?>".
Is there a way of scouring the folder for all the images that have not yet been entered into MySQL and dumping image names into the relevant columns? Further, can I filter by suggesting a prefix on the file name (all files will beging with "eg_" for example? And for preassigning things like the story ID which will be the same for that particular batch?
What I want to do then is use a form system for updating the records with the remaining text fields the way I update my other story driven tables on the site. That bit is easy.
Can anyone help?
Thanks
On my site (http://www.flyingchair.net) I have a photo section. There are two databases. One database is an index of picture stories, each story with a unique key, the second is a database of pictures, each picture having a unique key AND having the story key that identifies which bacth of pictures it belongs to. This is so I can go from a master photo page, to a details story page with the thumbnails and then to a picture page. I use JOIN USING to get the two tables to work together so I can fill in information from both databases on the same page.
My problem is this. Each picture has a name xyz.jpg for the main picture and xyz_th.jpg for the thumb (batched in Fireworks). The entry for in the database is the name of the file which is then parsed by PHP into the HREF statement (ie HREF="images/<?PHP $ etc. ?>".
Is there a way of scouring the folder for all the images that have not yet been entered into MySQL and dumping image names into the relevant columns? Further, can I filter by suggesting a prefix on the file name (all files will beging with "eg_" for example? And for preassigning things like the story ID which will be the same for that particular batch?
What I want to do then is use a form system for updating the records with the remaining text fields the way I update my other story driven tables on the site. That bit is easy.
Can anyone help?
Thanks