0)
{
$img_aleatoire = $tab_dossier[array_rand($tab_dossier)];
$max_width = 780;//maximum largeur acceptable
$max_height = 232;//maximum hauteur acceptable
list($width, $height) = getimagesize($img_aleatoire);
$ratioh = $max_height/$height;
$ratiow = $max_width/$width;
$ratio = min($ratioh, $ratiow);
$ratio = $ratio <= 1? $ratio : 1;// uniquement si l'on ne veut pas agrandir les photos de plus petites dimensions que $max_width et $max_height
$width = intval($ratio*$width);
$height = intval($ratio*$height);
echo '';
}
else
{
echo 'Pas de fichier de type '.implode(',',$ext_ok).' dans le répertoire '.$dossier;
// ou affichage d'une image par défaut provenant d'un autre répertoire
}
?>