[libsocialcache] Purge cached image files correctly

Previously, the cleanup routine was called without executing the
query to determine which images files needed to be purged.