added to database.js

added imageExists and wsExists