refactor attachment extensions and mock image processing for tests