How do I know if my website images are still in use?

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.