You are using rather general jQuery selector for this:
$('img[rel]')
Probably all of your images have "rel" attribute and that's why the modal opens on any image click. To choose a specific image to trigger your modal you need a specific selector, like - for example - id:
<div rel="carousel">
<div rel="carousel" id="center">
<div rel="carousel">
and then change your current selector to:
$('img#center')