remove thumbnails if no longer needed

fixes #6162

This should also be ported to Elgg 1.9