how to display images based on their ids in dialog box

how to display images based on their ids in dialog box

Hi,
i am having online shopping site which has lot of product images.
if user click the quick view , the corresponding product image should be display in the dialog box.
The following jquery display first image only if user click any one of the images.
Each product image has unique id.How to use this id and display the corresponding image according to user click.


  $(function () {
        $("#dialog").dialog({
            modal:true,
            autoOpen: false,
            resizable: false,
            width: "auto"
        });
        $(".dialogify").on("click", function (e) {
            e.preventDefault();
            //debugger;
            $("#dialog").html("<img src=@Model.DefaultPictureModel.ImageUrl width='" + $(this).attr("data-width") + "' height='" + $(this).attr("data-height") + "'>");
            $("#dialog").dialog("option", "position", {
               my: "center",
               at: "center",
               of: window
           });
            if ($("#dialog").dialog("isOpen") == false) {
                $("#dialog").dialog("open");
           }
       });
   });
</script>