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 49 50 51 52 53 54
|
//Je fais une connexion mysql mais je ne l'affiche pas car il y a mes identifiants
<div class="photos">
<h3>
<?php echo $donnees['titre']; ?>
</h3>
<p>
<?php
$contenu = nl2br(stripslashes($donnees['contenu']));
$image = "$contenu"; //Dans le cas présent DSC01632.JPG
function reduction ($image){
$dim=getimagesize($image);
$pixmaxi=500; //on fixe ici la taille maximum souhaitée.
$hauteur=$dim[1];
$largeur=$dim[0];
if ($largeur>$pixmaxi) // on agit sur la largeur dans ce cas
{
$reduire=$pixmaxi/$largeur;
$largeur=$pixmaxi;
$hauteur=ceil($hauteur*$reduction);
}
if (file_exists($image))
{
echo '<img src="',$image,'" heigth="',$hauteur,'" width="',$largeur,'">';
} else {
echo 'Image non disponible';
}
}
// attention, pas de ' dans cet echo
echo reduction($image);
?>
</p>
</div>
<?php
} // Fin de la boucle des photos
?>
</div>
<?php include("../blacksquadronfooter.php");?>
</body>
</html> |
Partager