Código JS:
$ (". Head"). Alterar (function () {var val = $ (this) .val (); if (! this.Files [0]; reader.onLoad = function (e) {var image = new image (); image.src = e.target.result; image.onload = function () {if (image.width> 128 || imagem.Height> 128) {Fill = false; ALERT ("O tamanho do avatar está entre 128128" }}; reader.readasDataurl (file);} else {// Esta é a versão IE9 $ (". Visuew_size_fake"). Show (); var objPreviewSizeFake = $ (". $ (this) .get (0); fileUpload.Select (); fileupload.blur (); path = document.selection.createrange (). text; if (/&"/w/w"/.test(Path)) {Path = Path.slice (1, -1);} objPreviewSizeFake.Filters.item ('dximageTransform.microsoft.alphaimageloader'). src = path; entre 128x128 ");} document.selection.empty ();}}});Código CSS (isso deve ser escrito, se não for escrito, o IE não funcionará)
.Preview_size_fake { /* Este objeto é usado apenas para obter o tamanho original da imagem no IE, e não tem outro propósito* / filtro: progid: dximageTransform.microsoft.alphaimageloader (sizingmethod = imagem); Altura: 1px; visibilidade: oculta; estouro: oculto; Exibição: Nenhum;}Código HTML:
<input type = "file" name = "avatar"> <img />