Imageviewer changes

improve image viewer upgrade code

CRM-14646