I have set up post thumbnails as set out in this tutorial.
I call on the image to show in a post by using
<?php the_post_thumbnail('my-custom-image'); ?>
This works great, I would however like this image to be linked so that it opens with fancybox showing the full image size.
I've tried this code:
<a rel="fancybox" href="<?php $thumbnail_id=get_the_post_thumbnail($post->ID); preg_match ('/src="(.*)" class/',$thumbnail_id,$link); echo $link; ?>"><?php the_post_thumbnail('my-custom-image'); ?></a>
But it only opens the thumbnail when the image is clicked.