Do you want to write your own code to do it or just use some existing stuff to get the work done? Image viewing / photo gallery support is built into many of the (free) content management systems that you get.
If you want to do the code yourself, you have to have smaller sized resizes for the image. You can use any image editing software like Photoshop (non-free) or The GIMP (free) or one of the zillions of other simpler or advanced tools available, as per your liking. There is one editor that comes with Microsoft Office also.
Once you do that, the code would look something like:
<a href="path-to-full-sized-image.jpg" target="_blank"><img src="small-thumbnail-of-image.jpg" /></a>