// The client side event ImageSelected takes two parameters, sender and e.
// Sender is the object which is raising the event
// e is the ImageViewerEventArgs
function WebImageViewer_ImageSelected(sender, e) {
var imageViewer = $find("WebImageViewer1");
// Get image selected
var imageItem = e.getImageItem();
// Gets the actual height of the image, not the height displayed in the
// browser
var imageHeight = imageItem.get_actualHeight();
// Gets the actual width of the image, not the width displayed in the
// browser
var imageWidth = imageItem.get_actualWidth();
// Get the index of the image item in the WebImageViewer's
// ImageItemCollection
var imageItemIndex = imageItem.get_index();
// Set the alt text of the image
var imageAlt = imageItem.get_altText();
alert("You have selected an image with the following attributes:\nIndex :: "
+imageItemIndex+"\nImage Height :: "+imageHeight+"\nImage Width :: "
+imageWidth);
}