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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| <!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php fctaffichimage('repimg/monimage.jpg', 120, 100)
function fctaffichimage($img_Src, $W_max, $H_max) {
if (file_exists($img_Src)) {
// ----------------------------------------------------
// Lit les dimensions de l'image source
$img_size = GetImageSize($img_Src);
$W_Src = $img_size[0]; // largeur source
$H_Src = $img_size[1]; // hauteur source
if(!$W_max) { $W_max = 0; }
if(!$H_max) { $H_max = 0; }
// ----------------------------------------------------
// Teste les dimensions tenant dans la zone
$W_test = round($W_Src * ($H_max / $H_Src));
$H_test = round($H_Src * ($W_max / $W_Src));
// ----------------------------------------------------
// si l image est plus petite que la zone
if($W_Src<$W_max && $H_Src<$H_max) {
$W = $W_Src;
$H = $H_Src;
// sinon si $W_max et $H_max non definis
} elseif($W_max==0 && $H_max==0) {
$W = $W_Src;
$H = $H_Src;
// sinon si $W_max libre
} elseif($W_max==0) {
$W = $W_test;
$H = $H_max;
// sinon si $H_max libre
} elseif($H_max==0) {
$W = $W_max;
$H = $H_test;
// sinon les dimensions qui tiennent dans la zone
} elseif($H_test > $H_max) {
$W = $W_test;
$H = $H_max;
} else {
$W = $W_max;
$H = $H_test;
}
// ----------------------------------------------------
} else { // si le fichier image n existe pas
$W = 0;
$H = 0;
}
?>
<img src="<?php echo $img_Src; ?>" width="<?php echo $W; ?>" height="<?php echo $H; ?>"/>
<?php }
// Affiche : src="..." width="..." height="..." pour la balise img
// ---------------------------------------------------------------------------------------
//fctaffichimage("a.jpg", "60", "60");
include_once 'AccB.php';
$Acc=new AccB();
echo '<table cellpadding="14" cellspacing="12"><tr>';
for($i=0;$i<8;$i++)
{
$id=rand(1,33);
$re="select `Num`,`Nom`,`Prenom` ,`Photo` from `etudiant` where `Num`=$id;";
$r=$Acc->Select($re);
$rz=$r->fetch();
if($i==4)
echo "</tr><tr>";
echo "<td>";
echo "<a href='index.php?id=$id' title='$rz[1] $rz[2]'>";
$rz[3]="3GI\Etudiant/".$rz[3];
fctaffichimage($rz[3], "100", "100");
echo "<br>$rz[1] $rz[2]</a> moi $rz[3]</td>";
}
echo '</table></tr>';
?>
</body>
</html> |
Partager