Added image size check