added better error alerts for image width and height