Je viens de trouver un Script PHP pour une galerie Photo
qui fonctionne très bien chez FREE mais pas chez OVH
Si vous avez une idée
Merci a vous
David
<?php
error_reporting(E_ALL ^ E_NOTICE);
//---------------------------------------------------------------------------------------------------
// OPTIONS
//---------------------------------------------------------------------------------------------------
// Barre de navigation en haut de page
// (Navigation links on top)
$nav_haut="non"; // ("oui" ou "non")
// Barre de navigation en bas de page
// (Navigation links at bottom)
$nav_bas="oui"; // ("oui" ou "non")
// Afficher le nom du fichier image
// (display file name)
$aff_filename="non"; // ("oui" ou "non")
// Afficher le poids du fichier
// (display file size in Mb)
$aff_filesize="non"; // ("oui" ou "non")
$size_unit="o"; // ("o" ou "b" pour octets ou bytes)
// Afficher les dimensions de l'image
// (display file size, width and height)
$aff_dimensions="non"; // ("oui" ou "non")
// Afficher la date de modification de l'image
// (display mod time of picture)
$aff_modtime="non"; // ("oui" ou "non")
// Afficher des liens numerotes vers toutes les images
// (display links to all pictures)
$aff_links="non"; // ("oui" ou "non")
$nb_links=5; // interval
// Classer les images par (sort pictures with) :
// Nom de fichiers (filename) : "nom"
// Poids du fichier (file size) : "taille"
// Date de modification (modification date) : "date"
// Type de fichier (type of file, gif, jpg...) : "type"
$ordre="date";
// Inverser le sens de l'ordre
$sens=0; // (1 ou 0, sens normal : 0)
// Langue (Language)
// FRANCAIS
$LANG_start="Début";
$LANG_previous="Précédent";
$LANG_on="sur";
$LANG_next="Suivant >>";
$LANG_end="Fin >";
$LANG_picture="Photo";
$LANG_filename="Nom du fichier";
$LANG_modtime="Date de modification";
$LANG_filesize="Poids";
$LANG_width_height="Largeur-Hauteur";
// ENGLISH
/*
$LANG_start="Start";
$LANG_previous="Previous";
$LANG_on="on";
$LANG_next="Next";
$LANG_end="End";
$LANG_picture="Picture";
$LANG_filename="File name";
$LANG_modtime="Modification time";
$LANG_filesize="File size";
$LANG_width_height="Width-Height";
*/
//---------------------------------------------------------------------------------------------------
// FIN DES OPTIONS
//---------------------------------------------------------------------------------------------------
function mimetype($fichier)
{
if(eregi("\.gif$",$fichier)){$nom_type="GIF";}
else if(eregi("\.jpg$",$fichier)){$nom_type="JPG";}
else if(eregi("\.png$",$fichier)){$nom_type="PNG";}
else if(eregi("\.bmp$",$fichier)){$nom_type="BMP";}
return $nom_type;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?
// LISTING DE TOUTES LES IMAGES
$tableau=""; $i=0;
$handle=@opendir("$rep");
while ($fichier = @readdir($handle))
{
$extension=substr($fichier,-3);
if($fichier!="." && $fichier!=".." && (eregi("gif",$extension)||eregi("jpg",$extension)))
{
if($ordre=="nom") {$listing[$fichier]=$i;}
else if($ordre=="taille") {$listing[$fichier]=filesize("$rep/$fichier");}
else if($ordre=="date") {$listing[$fichier]=filemtime("$rep/$fichier");}
else if($ordre=="type") {$listing[$fichier]=mimetype("$rep/$fichier");}
else {$listing[$fichier]=mimetype("$rep/$fichier","image");}
}
$i++;
}
@closedir($handle);
if(!is_array($listing))
{
echo "<br><br><font face=\"Verdana\" size=\"2\">\n";
echo "Exemple d'appel de ce script : <br>\n";
echo "index.php?rep=toto/images</font><br>\n";
}
else
{
// TRI DE LA LISTE DES FICHIER
if($ordre=="nom") {if($sens==0){ksort($listing);}else{krsort($listing);}}
else if($ordre=="date") {if($sens==0){arsort($listing);}else{asort($listing);}}
else if($ordre=="taille"||$ordre=="type") {if($sens==0){asort($listing);}else{arsort($listing);}}
else {if($sens==0){ksort($listing);}else{krsort($listing);}}
// INDICES DES IMAGES DEBUT, PRECEDENTE, SUIVANTE ET FIN
$i=0;
while (list($cle,$val) = each($listing))
{
if($image=="") {$image=$cle;}
if($i==0) {$debut=$cle;}
if($savesuiv==1) {$suivant=$cle; $savesuiv=0;}
if($image==$cle)
{
$savesuiv=1;
$stopprev=1;
$numphoto=$i+1;
}
if($stopprev=="") {$precedent=$cle;}
$fin=$cle;
//echo "cle=$cle , val=$val , debut=$debut , precedent=$precedent , suivant=$suivant , fin=$fin<br>";
if($aff_links=="oui" && ($i+1)%$nb_links==0)
{
if($savesuiv==1) {$liens.="<b>";}
$liens.="(";
if($savesuiv!=1) {$liens.="<a href=\"index.php?rep=$rep&image=$cle\">";}
$liens.=$i+1;
if($savesuiv!=1) {$liens.="</a>";}
$liens.=") ";
if($savesuiv==1) {$liens.="</b>";}
}
$i++;
}
// BARRE DE NAVIGATION
$tableau.="<table align=\"center\" width=\"80%\">\n";
$tableau.="<tr><td nowrap width=\"11%\"><font face=\"Verdana\" size=\"1\">";
// Liens début et précédent
if($precedent!="")
{
$tableau.="<a href=\"index.php?rep=$rep&image=$debut\">< $LANG_start</a>|";
$tableau.="<a href=\"index.php?rep=$rep&image=$precedent\"><< $LANG_previous</a>\n";
}
$tableau.="</font></td><td align=\"center\" width=\"78%\"><font face=\"Verdana\" size=\"2\">$LANG_picture <b>$numphoto</b> $LANG_on <b>$i</b></font></td>";
$tableau.="<td align=\"right\" width=\"11%\" nowrap><font face=\"Verdana\" size=\"1\">";
// Liens suivant et fin
if($suivant!="")
{
$tableau.="<a href=\"index.php?rep=$rep&image=$suivant\">$LANG_next</a>|";
$tableau.="<a href=\"index.php?rep=$rep&image=$fin\">$LANG_end</a>";
}
$tableau.="</font></td></tr>\n";
$tableau.="</table>";
// AFFICHAGE
if(file_exists("$rep/$image"))
{
// Navigation du haut
if($nav_haut=="oui") {echo "$tableau\n";}
// Image
$taillefic = GetImageSize("$rep/$image");
echo "<IMG SRC=\"$rep/$image\" ".$taillefic[3].">\n";
// Navigation du bas
if($nav_bas=="oui") {echo "$tableau\n";}
// Liens sur toutes les images
if($aff_links=="oui") {echo "<br><font face=\"Verdana\" size=\"1\">$liens</font><br><br>\n";}
// Informations sur l'image
echo "<font face=\"Verdana\" size=\"2\">\n";
if($aff_filename=="oui")
{
echo "$LANG_filename : <b>$image</b><br>\n";
}
if($aff_modtime=="oui")
{
echo "$LANG_modtime : <b>".date("d/m/Y H:i",filemtime("$rep/$image"))."</b><br>\n";
}
if($aff_filesize=="oui")
{
$taille=filesize("$rep/$image");
if ($taille >= 1073741824) {$taille = round($taille / 1073741824 * 100) / 100 . " G".$size_unit;}
elseif ($taille >= 1048576) {$taille = round($taille / 1048576 * 100) / 100 . " M".$size_unit;}
elseif ($taille >= 1024) {$taille = round($taille / 1024 * 100) / 100 . " K".$size_unit;}
else {$taille = $taille . " ".$size_unit;}
if($taille==0) {$taille="";}
echo "$LANG_filesize : <b>$taille</b><br>\n";
}
if($aff_dimensions=="oui")
{
echo "$LANG_width_height : <b>$taillefic[0] x $taillefic[1]</b><br>\n";
}
echo "</font>\n";
}
else
{
echo "<font face=\"Verdana\" size=\"2\">L'image passée en paramètre n'existe pas.</font>";
}
}
?>
</body>
</html>