Bonjour tous le monde,
Voila je viens chercher un peu d'aide auprès de vous et de votre énorme savoir.
Je dois donc faire un script qui irais dans un dossier contenant des photos les répertorier dans un tableau, pour ensuite les afficher les une après les autres à la manière d'un diaporama.
Donc après moult et moult essaie j'arrive a faire un truc qui devrait marcher mais qui oh rage oh désespoir ne marche pas.
Voila la bête ( enfin la bestiole ) :
A l'intérieur de l'array Pix il y a bien le chemin correct de mes images, je vois pas ce qui cloche et je tourne en rond.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Diapo_Photo</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript"> pix = new Array; var timeDelay = 5; var howMany = Pix.length; timeDelay *= 1000; var PicCurrentNum = 0; var PicCurrent = new Image(); PicCurrent.src = Pix[PicCurrentNum]; function startPix() { setInterval("slideshow()", timeDelay); } function slideshow() { PicCurrentNum++; if (PicCurrentNum == howMany) { PicCurrentNum = 0; } PicCurrent.src = Pix[PicCurrentNum]; document["ChangingPix"].src = PicCurrent.src; } <?php $a = 0; $handle = opendir("photos"); while (($file = readdir())!=false) { clearstatcache(); if($file!=".." && $file!=".") { echo "pix[$a] = 'photos/$file';"; $a++; } } closedir($handle); ?> </script> </head> <body OnLoad="startPix()"> <img name="ChangingPix" src="Pix[PicCurrentNum]" id="ChangingPix" /> </body> </html>
D'avance merci pour votre aide .
Partager