
Envoyé par
beejeridou
J'ai trouvé ca sur le net:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
<?
function redimage($img_src,$dst_w,$dst_h) {
// Lit les dimensions de l'image
$size = GetImageSize($img_src);
$src_w = $size[0]; $src_h = $size[1];
// Teste les dimensions tenant dans la zone
$test_h = round(($dst_w / $src_w) * $src_h);
$test_w = round(($dst_h / $src_h) * $src_w);
// Si Height final non précisé (0)
if(!$dst_h) $dst_h = $test_h;
// Sinon si Width final non précisé (0)
elseif(!$dst_w) $dst_w = $test_w;
// Sinon teste quel redimensionnement tient dans la zone
elseif($test_h>$dst_h) $dst_w = $test_w;
else $dst_h = $test_h;
// Affiche les dimensions optimales
echo "WIDTH=".$dst_w." HEIGHT=".$dst_h;
}
?>
<img src="monimage.jpg" <?redimage("monimage.jpg",XX,YY)?> /> |
merci pour ta réponse.
oui c'est bien cette fonction que j'utilise mais je dois afficher ca :
echo '<td><A href="javascript:PopupImage(\'trad/' , $tableau[$i] ,'\')"><IMG src="minitrad.php?f=' , $tableau[$i] , '" alt="Cliquer pour agrandir" border="2" class="image"></A></td>';
je sais pas comment fusionner la fonction avec ce dernier code ?
si je fais comment ca est ce que c'est correcte? :
1 2 3
| <? echo '<td><A href="javascript:PopupImage(\'trad/' , $tableau[$i] ,'\')"><IMG src="minitrad.php?f=' , $tableau[$i] , '" alt="Cliquer pour agrandir" border="2" class="image"' ; ?>
<?redimage("monimage.jpg",XX,YY)?>
<? echo '></A></td>'; |
merci
Partager