Images are used when posting posts or articles on websites, and multiple articles may use the same picture. if there is still an article in a picture, delete it. Do I need to create a table to store this information? Idimg_patharticle_id feels like this... images are used when posting posts or articles on websites, and multiple articles may use the same picture. if there is still an article in a picture, delete it. Do I need to create a table to store this information?
Something like this
Id img_path article_id
I feel that this will consume some performance. I don't know how to manage website images?
Reply content:
Images are used when posting posts or articles on websites, and multiple articles may use the same picture. if there is still an article in a picture, delete it. Do I need to create a table to store this information?
Something like this
Id img_path article_id
I feel that this will consume some performance. I don't know how to manage website images?
Scan the database over a period of time to see if the image address is included in the article?
As the side of image storage, you should not pay attention to whether there are any problems in use.
Use the regular expression matching log to delete records with requests that have never been requested. of course, this is related to your implementation. generally, if you request a record at least once after the upload, you can filter out whether the recently uploaded Image still exists. saved value
You can also create a table store. after all, it is impossible for your articles to delete and add images all day long? Record the number of references for one piece. For example, add 1 when adding an image to an article, subtract 1 when deleting the image, and scan regularly. if the number is 0, delete the image.
Test whether there are similar bad links
Look at the access log of the web Server that has not been accessed for a long time to see if it does not appear in the article...