Jump to content

PHP/MySql image gallery


VVaari

Recommended Posts

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? :)

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.