How do I link an image to another topic in a publication?

Would you please help us in understanding how to link a thumbnail to a larger version of the image in another topic? 

We would like to provide images as thumbnails, so that when users click the thumbnail, they are shown a larger version of that image in another topic. We tried highlighting the <image> elements for the thumbnail and then inserting an xref to the larger image. This way the <xref> element surrounded the <image> element, for example <xref><image></image></xref>. The cross-reference worked in the preview pane in Tridion Docs Publication Manager, but it did not work in the HTML output. 

In the HTML output, the image appeared after the xref, as shown in the following screen shot:

emoji