







|
[ Forums >> JavaScript >> Problèmes de création JavaScript / DHTML >> probleme pour savoir si l'image est entierement dans le cache ]
| > probleme pour savoir si l'image est entierement dans le cache |
[ Posté par llamo ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 29-04-2003 à 07:34 | 40 messages ]
  je voudrais savoir si en utilisant la mise en cache des images :
Code:
|
oImg[1] = new Image();
oImg[1].src = "./attachment.php?s=d9294ce1a87f3531caf4ffa27551a565&postid=15";
oImg[2] = new Image();
oImg[2].src = "http://www.llamo.com/image/3377.jpg";
oImg[3] = new Image();
oImg[3].src = "http://www.llamo.com/image/009.jpg";
oImg[4] = new Image();
oImg[4].src = "http://www.llamo.com/image/010.jpg";
|
|
si il est possible de savoir si l'image est entierement dans le cache ou si il est encore en train de la telecharger.
j'ai essayer un script (voir en dessous) mais il ne prend pas en compte que l'image est dans le cache
script qui est dans le <head>:
Code:
|
oImg = new Image();
oImg[1] = new Image();
oImg[1].src = "./attachment.php?s=d9294ce1a87f3531caf4ffa27551a565&postid=15";
oImg[2] = new Image();
oImg[2].src = "http://www.llamo.com/image/3377.jpg";
oImg[3] = new Image();
oImg[3].src = "http://www.llamo.com/image/009.jpg";
oImg[4] = new Image();
oImg[4].src = "http://www.llamo.com/image/010.jpg";
function redimImages2(pathImg,hauteurImg,largeurImg)
{
for (boucle=1; boucle<=4; boucle++) {
if (oImg[boucle].src = pathImg) {
h = oImg[boucle].height;
w = oImg[boucle].width;
break;
}
}
SW = screen.width;
taille = (SW * 630) / 800;
maxWidth = (largeurImg / 100) * taille;
maxHeight = (hauteurImg / 100) * taille * 65 / 100;
proporw = w / maxWidth;
proporh = h / maxHeight;
if (h > maxHeight) {
h = maxHeight;
w = w / proporh;
}
if (w > maxWidth) {
w = maxWidth;
h = h / proporw;
}
document.writeln("<a href="" + pathImg + "" target="_blank"">
<img src="" + pathImg + "" width="" + w + "" height="" + h + "" border="0"></a>");
}
function redimImages(pathImg,hauteurImg,largeurImg)
{
for (boucle=1; boucle<=4; boucle++) {
if ((oImg[boucle].src = pathImg)) {
if (oImg[boucle].complete == true) {
document.write("il est complet<br>");
redimImages2(pathImg,hauteurImg,largeurImg)
}
document.write("c'est le bon path<br>");
break;
}
}
}
|
|
Le but du script est de redimentionner l'image une fois seulement que l'image sera dans le cache mais pour l'instant, l'image est bien dans le cache du naviguateur mais il ne lie pas qu'il y est completement 'if (oImg[boucle].complete == true) { '
Merci pour l'aide que vous pourrez m'apporter
[ Ce Message a été édité par: llamo le 2003-04-29 10:29 ]
 
|
[ Posté par rom ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 30-04-2003 à 02:18 | 100 messages ]
  function popupimage(nomfichier)
{
nomimage = new Image();
nomimage.src=chemin+nomfichier;
x=nomfichier;
i=0;
attends();
}
function attends()
{
if (nomimage.width != 0) {setTimeout("ouvre()",0);return;}
i++;
if (i<200) {setTimeout("attends()",20);return;}
}
function ouvre()
{
largeur = nomimage.width;
hauteur = nomimage.height;
scb = "no";
g = window.open("","","width="+largeur+",height="+hauteur+",menubar=yes,scrollbars=yes,statusbar=no");
g.document.write('<html><head><title>'+x+'fuck</title></head><body style="margin-width:0;margin-height:0"><img name="imag" style="position:absolute;top:0;left:0;" src='+nomimage.src+' border=0 alt=""></body></html>');
g.document.close();
g.focus();
}
|
|
Services email :
  Vous devez vous identifier pour profiter des services par email du forum.
|

|