I am setting up a CMS where the user can upload images to be used in a slideshow. In the slideshow, when each image is displayed there will be an accompanying text displayed.
The database will store the image name and accompanying text. I want the user to be able to add and delete images. If they delete an image, I want this to be removed from the image folder. If the slideshow is only going to have 5 images, would it be best to store the images on the database or is there an easy way to allow a user to delete the image from an image folder as well as the database?
Apologies for the lengthy question.
You should not store the image data in the database. Store a link to the image location, but not the actual image.
When a user wants to delete a picture, SELECT the link to the file, unlink it, and then DELETE the row from the table.
The problem with this is that I could be left with dozens of images in an image folder that are no longer used, thus taking up valuable server space
Click the link in my previous post.
Apologies, Yes that is exactly what I need. Many thanks.