fixing TypeError, ticket #12285

this should fix error when opening image viewer from Image link.

To test it open image viewer, go to Image Link  and open given link in separate window.

TypeError issue was only noticed with big images.