Я пытаюсь загрузить изображение с указанной ссылки
 var imgPath = $(imgLink).attr('href');
и добавьте его на страницу, чтобы я мог вставить его в данный элемент для средства просмотра изображений. Несмотря на то, что я искал Stackoverflow и документы jQuery без конца, я не могу понять это.
После загрузки изображения я хочу установить для него разные значения, такие как ширина, высота и т.д.
Update:
Это то, что я получил. Проблема, с которой я сталкиваюсь, заключается в том, что я не могу запускать функции jQuery в элементе img.
function imagePostition(imgLink) {
// Load the image we want to display from the given <a> link       
// Load the image path form the link
var imgPath = $(imgLink).attr('href');
// Add image to html
$('<img src="'+ imgPath +'" class="original">').load(function() {
    $(imgLink).append(this);
    var img = this;
    // Resize the image to the window width
    // http://stackoverflow.com/info/1143517/jquery-resizing-image
    var maxWidth = $(window).width();       // window width
    var maxHeight = $(window).height();     // window height
    var imgWidth = img.width;               // image width
    var imgHeight = img.height;             // image height
    var ratio = 0;                          // resize ration
    var topPosition = 0;                    // top image position
    var leftPostition = 0;                  // left image postiton
    // calculate image dimension
    if (imgWidth > maxWidth) {
        ratio = imgHeight / imgWidth;
        imgWidth = maxWidth;
        imgHeight = (maxWidth * ratio);
    }
    else if (imgHeight > maxHeight) {
        ratio = imgWidth / imgHeight;
        imgWidth = (maxHeight * ratio);
        imgHeight = maxHeight;
    }
    // calculate image position
    // check if the window is larger than the image
    // y position
    if(maxHeight > imgHeight) {
        topPosition = (maxHeight / 2) - (imgHeight / 2);
    }
    // x position
    if(maxWidth > imgWidth) {
        leftPostition = (maxWidth / 2) - (imgWidth / 2);
    }
    $(imgLink).append(img);
    // Set absolute image position
    img.css("top", topPosition);
    img.css("left", leftPostition);
    // Set image width and height
    img.attr('width', imgWidth);
    img.attr('height', imgHeight);  
    // Add backdrop
    $('body').prepend('<div id="backdrop"></div>');
    // Set backdrop size
    $("#backdrop").css("width", maxWidth);
    $("#backdrop").css("height", maxHeight);
    // reveal image
    img.animate({opacity: 1}, 100)
    img.show()
});
};