Is this possible? PHP + Gallery

Soldato
Joined
1 Feb 2006
Posts
8,188
Hi,

I have written a PHP script to auto generate images from a specified directory for a simple gallery. This works well but what I want to do is add a search feature. This is what I intend to do:

Load path to image, image description and tags from IPTC data into a DB. Then search the tags or keywords from the db and write the path. The problem though is how do I trigger a DB update when a new image is placed in the directory? Is there any way to detect if a folders contents change? If so, then I could probably trigger a cron job to update the image db.

I don't want to have to do anything manually once this is coded so that the user can just upload files and the rest will be done automatically.

Thanks in advance.
 
If you have shell access to the server and can install programs etc. you could bung FAM (File Alteration Monitor) on there and use that to trigger the update.

Easier option would be to run a cron job (a decent hosting provider will have the ability for you to run these) every minute looking for changes.
 
If you have shell access to the server and can install programs etc. you could bung FAM (File Alteration Monitor) on there and use that to trigger the update.

Easier option would be to run a cron job (a decent hosting provider will have the ability for you to run these) every minute looking for changes.

I had thought of running a cron job every night but the problem is if the user deletes some images. I could have some custom error page for this but its not ideal. I just wanted to that i was going about this the proper way. Thanks
 
Back
Top Bottom