Bonjour @ tous,
Je suis en train de mettre en place un petit code PHP pour afficher les photos d'un répertoire donné.
Quand je place mon photo.php à la racine de mon FTP, pas de problème, tout s'affiche comme désiré. Cependant, quand je déplace mon photo.php dans le bon répertoire (afin que mon FTP soit organisé >> /mobile/photos), la plus rien ne fonctionne, je n'ai pas mes photos qui s'affiche.
Pourriez-vous m'aider s'il vous plait ?
Merciii !
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Reprise 08/08/2016</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style data-mce-type="text/css"> body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background:#f5f5f5; } img { /* basic responsive img */ max-width: 100%; height: auto; width: auto\9; /* IE8 */ display: block; -webkit-border-top-left-radius: 1.5px; -webkit-border-top-right-radius: 1.5px; -moz-border-radius-topleft: 1.5px; -moz-border-radius-topright: 1.5px; border-top-left-radius: 1.5px; border-top-right-radius: 1.5px; } </style> </head> <body> <?php $directory = "/images/phocagallery/entrainements/reprise/"; $images = glob("" . $directory . "*.jpg"); $imgs = ''; foreach($images as $image){ $imgs[] = "$image"; } shuffle($imgs); $imgs = array_slice($imgs, 0, 20); foreach ($imgs as $img) { echo "<img src='$img' /> "; } ?> </body> </html>
Partager