VVaari Posted September 6, 2010 Share Posted September 6, 2010 I'm creating PHP/MySQL image gallery for company intranet. There are about 20000 images that are located on server or possibly on external NAS-drive and they are organized into categorized folders with multiple subcategories and sub-subcategories. Database has two tables, gallery_images and gallery_categories. Table gallery_images has image filepath, tags and category_id where it belongs. Table gallery_categories has category name and parent category if its sub-category. The thing is that users can use some other software to browse images, like Picasa or Windows Explorer. That's why images need to be organized into folders too instead of just using database. Users might even want to move images to different categories or delete them using filesystem. Problem is how do i keep database up-to-date if filesystem is used to modify images or folder structure. I was thinking doing somekind of php-script that runs overnight or manually. Script would first clean database by searching images from db that doesn't exist in its current path and deleting them from db. Then it would scan (php's scandir?) image directory and check if each image exists in db. If image doesnt exists, then it would parse filepath (for example /category1/subcategory3/myImage.jpg) and check if new categories needs to be added and then it would read image metadata (EXIF, IPTC) tags and insert those tags and filepath to database. What do you think, will I run into problems if I need to scan 20000 files, reading metadata and querying db for each file? Quote Link to comment Share on other sites More sharing options...
Alex Posted September 6, 2010 Share Posted September 6, 2010 If it's a one-time kind of thing then it shouldn't be a problem. If you have the knowhow you could create a quick application in a compiled language (e.g. C++) that would be much faster. PHP isn't really made for something like that, but it will work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.