#1970 - Make add watermarks more secure and add unit tests.
This follows #1855 and #1951...
- Ensured that invalid or illegal files are not added even if they have valid extensions.
- Added unit tests (currently there aren't any...)