arne
01-27-2006, 04:46 PM
Hi, it's difficult to explain but a rather easy question i think.
I have a code (see below) and i want to 'automatisize' it.
It works like this,
for every picture in the database, it should make something like this:
picArray[0] = new Array(3)
picArray[0][0] = new Image();
picArray[0][0].src = "http://www.kempischbouwcenter.be/fotos/4.jpg";
picArray[0][1] = stdWidth;
picArray[0][2] = (stdWidth * 392)/522;
if (picArray[0][2]>stdHeight){
picArray[0][1] = (stdHeight*stdWidth)/picArray[0][2];
picArray[0][2] = stdHeight;
the problem is that i know i should use a while loop, and then i can make it, except for ONE small thing !!! The picArray[0], should become [1] witht he next photo, [2] after that, 3,4,5,...
LIke in the example below:
<!--
var picArray = new Array(1);
var stdHeight=375;
var stdWidth=525;
picArray[0] = new Array(3)
picArray[0][0] = new Image();
picArray[0][0].src = "http://www.kempischbouwcenter.be/fotos/4.jpg";
picArray[0][1] = stdWidth;
picArray[0][2] = (stdWidth * 392)/522;
if (picArray[0][2]>stdHeight){
picArray[0][1] = (stdHeight*stdWidth)/picArray[0][2];
picArray[0][2] = stdHeight;
}else{
}
}else{
}
picArray[1] = new Array(3)
picArray[1][0] = new Image();
picArray[1][0].src = "http://www.kempischbouwcenter.be/fotos/12b.jpg";
picArray[1][1] = stdWidth;
picArray[1][2] = (stdWidth * 392)/522;
if (picArray[1][2]>stdHeight){
picArray[1][1] = (stdHeight*stdWidth)/picArray[1][2];
picArray[1][2] = stdHeight;
}else{
}
picArray[2] = new Array(3)
picArray[2][0] = new Image();
picArray[2][0].src = "http://www.kempischbouwcenter.be/fotos/12c.jpg";
picArray[2][1] = stdWidth;
picArray[2][2] = (stdWidth * 392)/522;
if (picArray[2][2]>stdHeight){
picArray[2][1] = (stdHeight*stdWidth)/picArray[2][2];
picArray[2][2] = stdHeight;
}else{
}
AND SO ON
totalPic = 1;
// firstLim = 0;
// secondLim = -1;
I don't think it's that difficult, just a small number that should auto-change from zero till all the pics have been 'while-looped'.
THANK YOU VERY MUCH
I have a code (see below) and i want to 'automatisize' it.
It works like this,
for every picture in the database, it should make something like this:
picArray[0] = new Array(3)
picArray[0][0] = new Image();
picArray[0][0].src = "http://www.kempischbouwcenter.be/fotos/4.jpg";
picArray[0][1] = stdWidth;
picArray[0][2] = (stdWidth * 392)/522;
if (picArray[0][2]>stdHeight){
picArray[0][1] = (stdHeight*stdWidth)/picArray[0][2];
picArray[0][2] = stdHeight;
the problem is that i know i should use a while loop, and then i can make it, except for ONE small thing !!! The picArray[0], should become [1] witht he next photo, [2] after that, 3,4,5,...
LIke in the example below:
<!--
var picArray = new Array(1);
var stdHeight=375;
var stdWidth=525;
picArray[0] = new Array(3)
picArray[0][0] = new Image();
picArray[0][0].src = "http://www.kempischbouwcenter.be/fotos/4.jpg";
picArray[0][1] = stdWidth;
picArray[0][2] = (stdWidth * 392)/522;
if (picArray[0][2]>stdHeight){
picArray[0][1] = (stdHeight*stdWidth)/picArray[0][2];
picArray[0][2] = stdHeight;
}else{
}
}else{
}
picArray[1] = new Array(3)
picArray[1][0] = new Image();
picArray[1][0].src = "http://www.kempischbouwcenter.be/fotos/12b.jpg";
picArray[1][1] = stdWidth;
picArray[1][2] = (stdWidth * 392)/522;
if (picArray[1][2]>stdHeight){
picArray[1][1] = (stdHeight*stdWidth)/picArray[1][2];
picArray[1][2] = stdHeight;
}else{
}
picArray[2] = new Array(3)
picArray[2][0] = new Image();
picArray[2][0].src = "http://www.kempischbouwcenter.be/fotos/12c.jpg";
picArray[2][1] = stdWidth;
picArray[2][2] = (stdWidth * 392)/522;
if (picArray[2][2]>stdHeight){
picArray[2][1] = (stdHeight*stdWidth)/picArray[2][2];
picArray[2][2] = stdHeight;
}else{
}
AND SO ON
totalPic = 1;
// firstLim = 0;
// secondLim = -1;
I don't think it's that difficult, just a small number that should auto-change from zero till all the pics have been 'while-looped'.
THANK YOU VERY MUCH