check if image is null before getting height and width