sandravega
Programmer
Hi,
This is my goal: I'm programming a dinamic site wich allows the administrator to load some images and then display them in the front-end site, something like a catalog.
The front end is mainly a table wich shows the images and the text that the administrator saved in a Data Base, and I have 2 pages: one that displays all the images in a little size and an abstract of the texts and the other with the hole image at full size and the complete text.
But, the administrator can load 60 x 60 images to 300 x 300 images.
When I display them in the "all" page, I want them in 94 x 94 size "unless" the image is smaller, then I want it to be showed in its proper size
(example: an image of 200 x 200 should be showed in 94 x 94, an image of 65 x 65 should be showed in 65 x 65 size)
Here´s the code:
(idsN() is an array where I previously recovered the ids of every image and imagenesN() is an array with the correspondingly paths)
I also put a document.open() and document.close() statement before and after the for... next loop that goes over the array
But the images show as a single point, and I must refresh manually the page to see them in their right size
I'm not sure I'm using the right approach, maybe document.write is not a good idea for the current document... Maybe I just have to use the "onComplete" body event to resize the images...
Thanks you a lot
Sandra Vega
This is my goal: I'm programming a dinamic site wich allows the administrator to load some images and then display them in the front-end site, something like a catalog.
The front end is mainly a table wich shows the images and the text that the administrator saved in a Data Base, and I have 2 pages: one that displays all the images in a little size and an abstract of the texts and the other with the hole image at full size and the complete text.
But, the administrator can load 60 x 60 images to 300 x 300 images.
When I display them in the "all" page, I want them in 94 x 94 size "unless" the image is smaller, then I want it to be showed in its proper size
(example: an image of 200 x 200 should be showed in 94 x 94, an image of 65 x 65 should be showed in 65 x 65 size)
Here´s the code:
(idsN() is an array where I previously recovered the ids of every image and imagenesN() is an array with the correspondingly paths)
Code:
foto<%=IdsN(i)%>=new Image();
foto<%=IdsN(i)%>.src="<%=imagenesN(i)%>";
oksize=foto<%=IdsN(i)%>.width;
if (foto<%=IdsN(i)%>.width>94) {
imagen="<img src='"+"<%=imagenesN(i)%>"+"' name='"+"foto<%=IdsN(i)%>"+"' border='0' width='94'>";
}else{
imagen="<img src='"+"<%=imagenesN(i)%>"+"' name='"+"foto<%=IdsN(i)%>"+"' border='0' width='" + oksize+ "'>";
document.write(imagen);
I also put a document.open() and document.close() statement before and after the for... next loop that goes over the array
But the images show as a single point, and I must refresh manually the page to see them in their right size
I'm not sure I'm using the right approach, maybe document.write is not a good idea for the current document... Maybe I just have to use the "onComplete" body event to resize the images...
Thanks you a lot
Sandra Vega