Added JavaScript check for empty image field to avoid troublesome flow.