Remove non-used images

By Toledoh - February 3, 2016

Hi Guys.

I've got a few websites that have a huge amount of uploaded images... real-estate sites mainly. For instance, one client runs auctions.  They upload a few thousand images for each auction, then delete the record once the auction is complete.  but this leaves the thousands of images on the server, and no easy way to remove them.

Is there a plugin that could somehow search the cmsb/uploads folder and see if there are any records that use each image - and if not, delete them?  

Cheers,

Tim (toledoh.com.au)

By Damon - February 3, 2016

Hi Tim,

Uploaded images should be deleted when the record they are attached to is deleted. There should be no orphan uploaded files.

I tested with a local installation that if a record with uploaded files (either through upload field or WYSIWYG editor) is deleted, the uploaded files are deleted too.

Can you confirm that deleting a record doesn't delete the attached uploads? And is this something that happens consistently?

First step is to make sure the images are deleting when the record is deleted. Then after that is resolved, we can look at the issue of orphaned uploads.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/