Only show "new" images...?
here is the basics.
I have a gallery that is run from a database. the DB table only has some basics and a file name. I will be building a edit page so that you can easily add new images to the gallery. I will upload the image through FTP.
I would like the edit page to grab the file list from the table, and scan the files on the server. any img that is NOT in the database will be the ones that show.
Now I know I could just loop through the directory and check each filename in the database... but whats the best way? Should I create an array of the files, then just loop through that? two arrays?
Thanks! :wave:
Re: Only show "new" images...?
What you should do is have a "uploaded" folder where you upload all the new pictures. Then run the edit page. The edit page should look in the "uploaded" folder, write to the db, then copy that image to another folder "images", then move to the next image. So afterward, the "uploaded" folder will be empty, and you can upload more later.
Re: Only show "new" images...?
Select the list of file names from the database, put them into an array, then use array_diff.