Muy buenas. Hace poco creé mi primera web (soy muy muy novato, aviso) y ahora he subido mis primeras imágenes. He creado un album con las miniaturas y estas las he vinculado a las páginas con las fotos. El problema es que las fotos salen enormes y me gustaría que se redimensionasen al tamaño de la pantalla. Llevo un rato investigando y creo que eso se hace con un javascript. He copiado el código de un script de una página con una foto que sí se redimensiona y he probado a pegarlo por todas partes en una de mis páginas con la imagen que quiero que se ajuste y nada. He probado a pegarlo por todas partes y ni flores. A ver si alguien puede explicarme una forma sencilla de hacerlo y si no es mucho pedir, teniendo en cuenta que soy casi analfabeto en estas lides. Por si sirve de algo copio aquí el script que he copiado;
<script type="text/javascript">
var actualWidth = 3600; var actualHeight = 4800; var message; var b_fullsize=0;
function tableWidth()
{return windowWidth()-100;}
function windowWidth() {
if (navigator.appName=="Netscape")
return window.innerWidth;
return document.body.offsetWidth;
}
function scaleImg() {
what = document.getElementById('thepic');
actualHeight=what.height; actualWidth=what.width;
if ( fitsInWindow() ) return;
if(what.width==tableWidth())
{what.width=actualWidth;what.height=actualHeight;}
else{
what.style.cursor = "pointer";
what.width=tableWidth();what.height = (actualHeight/actualWidth) * what.width;
}
}
function showOnclick()
{
what = document.getElementById('thepic');
if (actualWidth == what.width)
return scaleImg();
else if (actualWidth > what.width)
{
what.width=actualWidth;
what.height=actualHeight;
}
}
function liveResize() {
what = document.getElementById('thepic');
actualHeight=what.height; actualWidth=what.width;
if (fitsInWindow())return;
if (what.width!=actualWidth) {
what.width=tableWidth();what.height = (actualHeight/actualWidth) * what.width;}}
function setImgWidth(){
if (fitsInWindow())return;
document.getElementById('thepic').width=tableWidth();
}
function fitsInWindow() {
what = document.getElementById('thepic');
var actualWidth= what.width;
if (actualWidth<tableWidth()) {
displayWarning("none");
return true;
} else {
return false;
}
}
</script>
<script type="text/javascript">
var actualWidth = 3600; var actualHeight = 4800; var message; var b_fullsize=0;
function tableWidth()
{return windowWidth()-100;}
function windowWidth() {
if (navigator.appName=="Netscape")
return window.innerWidth;
return document.body.offsetWidth;
}
function scaleImg() {
what = document.getElementById('thepic');
actualHeight=what.height; actualWidth=what.width;
if ( fitsInWindow() ) return;
if(what.width==tableWidth())
{what.width=actualWidth;what.height=actualHeight;}
else{
what.style.cursor = "pointer";
what.width=tableWidth();what.height = (actualHeight/actualWidth) * what.width;
}
}
function showOnclick()
{
what = document.getElementById('thepic');
if (actualWidth == what.width)
return scaleImg();
else if (actualWidth > what.width)
{
what.width=actualWidth;
what.height=actualHeight;
}
}
function liveResize() {
what = document.getElementById('thepic');
actualHeight=what.height; actualWidth=what.width;
if (fitsInWindow())return;
if (what.width!=actualWidth) {
what.width=tableWidth();what.height = (actualHeight/actualWidth) * what.width;}}
function setImgWidth(){
if (fitsInWindow())return;
document.getElementById('thepic').width=tableWidth();
}
function fitsInWindow() {
what = document.getElementById('thepic');
var actualWidth= what.width;
if (actualWidth<tableWidth()) {
displayWarning("none");
return true;
} else {
return false;
}
}
</script>