JavaScript - Validar Imagenes +Javascript

 
Vista:

Validar Imagenes +Javascript

Publicado por Rolando (1 intervención) el 13/02/2008 05:50:34
Necesito validar de una imagen su resolucion, me hace falta resolver esto lo mas rapido posible es importante , la imagen se sube a un formulario mediante un input file el metodo que de hecho para mal funcina solo en IE y no en firefox miren el codigo:

function validateImage(filename,desiredWidth,desiredHeight)
{
var picture;
picture = new Image();
picture.src =filename;

alert(
picture.width+" X "+ picture.height+
" ->"+
( (picture.width == desiredWidth ) &&
(picture.height == desiredHeight) )
);

return ( (picture.width == desiredWidth )&&
(picture.height == desiredHeight) );

}

agradesco cualquier ayuda
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de ScriptShow
Val: 2.019
Plata
Ha mantenido su posición en JavaScript (en relación al último mes)
Gráfica de JavaScript

RE:Validar Imagenes +Javascript

Publicado por ScriptShow (692 intervenciones) el 15/02/2008 18:04:08
Saludos Rolando,

Vamos a ver si ésto te puede servir.

<html>
<head>
<script type="text/javascript">
function alertComplete()
{
alert("Ancho=" + document.getElementById('compman').width + " X " + "Alto=" + document.getElementById('compman').height);
}
</script>
</head>
<body onload="alertComplete()">

<img id="compman" src="imagen.gif" alt="Computerman" width="107" height="98" />

</body>
</html>

Espero te sea útil.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar