Implemented Config settings and error handling of file metadata information

1. Added the config settings for defining IMAGEDIR
2. Fixed issues with handling  files which don't have metadata information