Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Exemple: http://machica.bl.ee/demonstration/diapo.php
- $img = array qui va contenir toute les images
- $page = Poisition dans le nombre d'image
- $num = nombre totale d'image
- Le dossier contenant les images doit uniquement contenir des images
- */
- $repertoire = "LienVersTonDossier/*.*";
- $img = array();
- if($dossier = opendir('img'))
- {
- $img = glob($repertoire);
- }
- //On classe les image dans l'ordre alphabetique
- sort($img);
- //On s'assure que la page indiqué est une valeur numérique
- $_GET['page'] = (int) $_GET['page'];
- $num = sizeof($img) - 1;
- //Si la page indiqué est en dessous de zéros il a une erreur
- if($_GET["page"] <= -1){
- $error = true;
- }
- //Et inversement
- if($_GET["page"] > $num){
- $error = true;
- }
- //On redirige sur la première image en cas d'erreur
- if($error){
- header('Location: diapo.php?a=0');
- }
- ?>
- <!DOCTYPE html>
- <html lang="fr">
- <head>
- <meta charset="UTF-8">
- <title>Diapo</title>
- <meta name="description" content="">
- <!-- Design que vous pouvez retiré
- <style>
- html, body {
- padding : 0;
- margin : 0;
- height : 100%;
- background-color: pink;
- }
- footer{
- position: absolute;
- bottom: 0; left: 0;
- clear : both;
- width : 100%;
- height : 50px;
- text-align: right;
- }
- img {
- display: block;
- margin: 0 auto;
- max-width: 100%;
- max-height: 100%;
- background-color: #f3de89;
- border: 5% solid #1120ed;
- border: 5% solid #c4c8cc;
- -moz-border-radius-topleft: 5%;
- -moz-border-radius-topright: 5%;
- -moz-border-radius-bottomright: 5%;
- -moz-border-radius-bottomleft: 5%;
- -webkit-border-top-left-radius: 5%;
- -webkit-border-top-right-radius: 5%;
- -webkit-border-bottom-right-radius: 5%;
- -webkit-border-bottom-left-radius: 5%;
- }
- .guttentag{
- text-align:right;
- }
- </style>
- -->
- </head>
- <body>
- <img src="image/<?php echo $img[$_GET["page"]];?>">
- <footer>
- <a id="ar" href="Adresse de sortie">Lien pour sortir</a>
- <div id="guttentag">
- <!-- Fleche de retour -->
- <?php
- if($_GET['page'] != 0){ ?>
- <a href="diapo.php?page=0"> « </a>
- <a href="diapo.php?page=<?php echo $_GET["page="]-1 ?>"> ‹ </a>
- <?php } ?>
- <!-- Fleche d avance -->
- <?php
- if($_GET["a"] != $num){ ?>
- <a href="diapo.php?a=<?php echo $_GET["page"]+1 ?>">› </a>
- <a href="diapo.php?a=<?php echo $num; ?>"> »</a>
- <?php } ?>
- </div>
- </footer>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment