Escribir el tamaño y las dimensiones de una imagen
Publicado por raul (11 intervenciones) el 05/07/2005 20:28:44
Buenas tengo el siguiente codigo:
Aqui llamo a la funcion:
<input name='verimagen' type='button' onClick=verfotomenu('ruta','Fotografía'); value='Ver Foto'>
La funcion es la siguiente:
El problema q tengo es q cuando imprimo this.width, this.height me aparece "undefined" y en this.length me aparece 0 (creo q sea para saber el tamaño q ocupa el archivo).
function verfotomenu(nombre,titulo)
{
ventana=window.open('','ventana','toolbar=no,location=no,scrollbars=no,resizable=no')
ventana.document.write('<html><head><title>' + titulo + '</title></head><body bgcolor="#FFFFFF" scroll="no"><table width="220" border="0" cellspacing="0" cellpadding="0"><tr><td height="10"></td></tr><tr><td><table width="220" border="0" cellspacing="0" cellpadding="0"><tr><td width="10"></td><td><table width="200" border="0" cellspacing="0" cellpadding="0"><tr><td height="150"><img src="' + nombre + '" onLoad="opener.redimensionar(this.width,this.height)"></td></tr><tr><td height="20">Tamaño:', this.length ,'</td></tr><tr><td height="20">Dimensiones:', this.width ,' x ', this.height,'</td></tr></table></td><td width="10"></td></tr></table></td></tr><tr><td height="10"></td></tr></table>')
ventana.document.close()
}
Gracias por vuestra ayuda.
Aqui llamo a la funcion:
<input name='verimagen' type='button' onClick=verfotomenu('ruta','Fotografía'); value='Ver Foto'>
La funcion es la siguiente:
El problema q tengo es q cuando imprimo this.width, this.height me aparece "undefined" y en this.length me aparece 0 (creo q sea para saber el tamaño q ocupa el archivo).
function verfotomenu(nombre,titulo)
{
ventana=window.open('','ventana','toolbar=no,location=no,scrollbars=no,resizable=no')
ventana.document.write('<html><head><title>' + titulo + '</title></head><body bgcolor="#FFFFFF" scroll="no"><table width="220" border="0" cellspacing="0" cellpadding="0"><tr><td height="10"></td></tr><tr><td><table width="220" border="0" cellspacing="0" cellpadding="0"><tr><td width="10"></td><td><table width="200" border="0" cellspacing="0" cellpadding="0"><tr><td height="150"><img src="' + nombre + '" onLoad="opener.redimensionar(this.width,this.height)"></td></tr><tr><td height="20">Tamaño:', this.length ,'</td></tr><tr><td height="20">Dimensiones:', this.width ,' x ', this.height,'</td></tr></table></td><td width="10"></td></tr></table></td></tr><tr><td height="10"></td></tr></table>')
ventana.document.close()
}
Gracias por vuestra ayuda.
Valora esta pregunta


0