Here’s  a short bit of code for our uploader script that will delete old user images when a user uploads a new one. You can see the additions on lines 80-93 here