added implementation for only allowing images