Parse error: syntax error, unexpected '}'
Résolu/Fermé
juracitepark
Messages postés
58
Date d'inscription
mardi 3 novembre 2009
Statut
Membre
Dernière intervention
8 avril 2013
-
3 janv. 2013 à 21:17
typiac Messages postés 92 Date d'inscription lundi 9 mai 2011 Statut Membre Dernière intervention 14 janvier 2015 - 3 janv. 2013 à 23:17
typiac Messages postés 92 Date d'inscription lundi 9 mai 2011 Statut Membre Dernière intervention 14 janvier 2015 - 3 janv. 2013 à 23:17
A voir également:
- Parse error: syntax error, unexpected '}'
- Cmos checksum error ✓ - Forum Carte-mère/mémoire
- Fan error lenovo - Forum Refroidissement
- Error 10 pioneer ✓ - Forum Autoradio
- Playback error reconnect in 3s (1/5) francais - Forum Box et Streaming vidéo
- Whea error occt - Forum Processeur
2 réponses
juracitepark
Messages postés
58
Date d'inscription
mardi 3 novembre 2009
Statut
Membre
Dernière intervention
8 avril 2013
1
3 janv. 2013 à 21:34
3 janv. 2013 à 21:34
Erreur réglé, j'ai pris un code plus simple et plus complet ;):
$dossier = 'PHOTO'; $dossier_images = $dossier.'/*.{jpg,jpeg,gif,png}'; $tab_dossier = glob($dossier_images,GLOB_BRACE); $img_aleatoire = $tab_dossier[array_rand($tab_dossier)]; $max_width = 100;//maximum largeur acceptable $max_height = 100;//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 ou $max_height $width = intval($ratio*$width); $height = intval($ratio*$height); echo '<img src="'.$img_aleatoire.'" width="'.$width.'" height="'.$height.'" alt="image" />';
typiac
Messages postés
92
Date d'inscription
lundi 9 mai 2011
Statut
Membre
Dernière intervention
14 janvier 2015
1
3 janv. 2013 à 23:17
3 janv. 2013 à 23:17
Ton problème venait des "#" qui transformaient la fin de tes lignes en commentaires...
N'oublies pas de mettre le message en résolu! ^^
N'oublies pas de mettre le message en résolu! ^^