[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.
Merge pull request #14 from chriadam/purgeImages

[libsocialcache] Purge cached image files correctly