I thought I'd start a discussion for the automatic removal of unused thumbs, previews, thumbnails, etc. generated by the image, image_attachement, and upload_image modules.
This could be run at cron. It seems there is a standard on the images created in {files}. Shouldn't there be an easy way to automatically delete images whose parent nodes have been deleted?
For example: A story or blog is created with upload_images, and image_attachement. "Child" type nodes are generated with the "parent" name already in place in {files}. Such as: "image1.preview.jpg", "image1.thumbnai.jpg", and the the original image, "image1.jpg". Couldn't we call a function for db_query?
Such as:
db_query("DELETE FROM {upload_images} WHERE oid = %d", $node->nid);
or:
db_query("DELETE FROM {files} WHERE oid = %d", $node->nid);
I know it's not that easy. But is there a concensus on the need for such a module? I'm new at Drupal, but I wanted feedback on this before considering options on implementing/paying for/ coding/ YET ANOTHER IMAGE module.
So what are your thoughts?
Comments
One way to look at this would be the missing "original" image.
"image1.jpg" is not in {files}, therefore we delete "image1.preview.jpg", "image1.thumb.jpg", etc.
cleanup images
I've been running drupal for a year or so and it seems my site is filling up with images. I'm on drupal 4.6, using image module and htmlarea module. Users can upload images from forum duscussies and frequently do this, it seems to be the most important feature of the forum.
One of the problems I'm seeing is that nodes (ie forum discussions) are cleaned up but the image node they refer to stays and is thus orphaned. I would very much like to delete all image nodes not being referred to from any node anymore but I'm not up to the task of writing a module for this myself.
Johan
I've put a bounty on this in
I've put a bounty on this in paid services. Hopefully we'll get some takers. Might not be enough money, I don't know...