MB-19
creation of a new function 'is_valid_image'