implementation XHImageViewer logic