Made a frontend + backend of Twitter clone in python (Flask) with fully login functionalities, cookie management system, and relational databases for storing data.
When the user makes an account, a default profile image and a background image is added to the user's account. When the user updates it, a new profile image and/or a new background image is added to the user's account page.
What the issue is
When the user again changes his/her profile image and/or background image, the new image is added to the folder Static/Images/Users/profile_img and Static/Images/Users/bg_img respectively where the previously stored images are present. The older images (i.e the images which do not currently constitutes either the user's profile image or background image) are still present in those folders.
For a small user base, this may not seem much, but as the number of users grow, it would become problematic as it would require more and more storage space.
What needs to be done
When the user changes his/her profile picture and/or background image unless the earlier image was NOT the default profile and background image, make a python script that will delete those older images once the user has specified what the new bg/profile picture is.
Note: The default images in those folders are named as default.png and default_bg.png and should not be deleted under any circumstances
Introduction
When the user makes an account, a default profile image and a background image is added to the user's account. When the user updates it, a new profile image and/or a new background image is added to the user's account page.
What the issue is
When the user again changes his/her profile image and/or background image, the new image is added to the folder
Static/Images/Users/profile_img
andStatic/Images/Users/bg_img
respectively where the previously stored images are present. The older images (i.e the images which do not currently constitutes either the user's profile image or background image) are still present in those folders.For a small user base, this may not seem much, but as the number of users grow, it would become problematic as it would require more and more storage space.
What needs to be done
When the user changes his/her profile picture and/or background image unless the earlier image was NOT the default profile and background image, make a python script that will delete those older images once the user has specified what the new bg/profile picture is.
Note: The default images in those folders are named as default.png and default_bg.png and should not be deleted under any circumstances