Bueno esta es una funcion que se me ocurrio hacer :
Si Porcentaje es igual a true entonces el ancho y el alto son los porcentajes. si es igual a false los anchos y alto son los definidos.
Aclaracion extra:
Las imagenes las tengo guardadas en una carpeta en su tamaño original , no pienso cambiar su tamaño y mucho menos crear copias en menor tamaño con php.
Las ubicaciones las tomo desde la mysql con un bucle while.
Código Javascript
:
Ver originalfunction Cuenta(Alto,Ancho,Porcentaje){
/* --- Variables --- */
var Imagen = document.images.length; /* -- Etiquetas Imagen -- */
/* --- Bucle para imagenes --- */
for(var i=1; i<Imagen; i++){
if(Porcentaje){
var Width = Imagen[this.length].width; /* -- Ancho de las etiquetas -- */
var Height = Imagen[this.length].height; /* -- Alto de las etiquetas -- */
var Altura = Height*Alto/100;
var Anchura = Width*Ancho/100;
Imagen[i].width=Altura;
Imagen[i].height=Anchura;
}else{
Imagen[i].width=Alto;
Imagen[i].height=Ancho;
}
}
}
Código HTML:
Ver original<!DOCTYPE html>
<script type="application/javascript" language="javascript" src="javascript.js" /></script> <input type="button" onclick="Cuenta(25,50,true);" value="Cuenta" /> <img src="http://l.yimg.com/cv/ip/ap/default/120224/0224_lucas_ml.jpg" name="img" />
el echo es que no se por que no anda ;S