Source : lesson_17_a0_image_size.php |
Résultat |
<?php echo "1_"; $size = getimagesize("../images/elephant_8.jpg"); for ($i=20;$i>4;$i=$i-2) { $h = $size[1]/$i; $w = $size[0]/$i; echo "<img src='../images/elephant_8.jpg' height=$h width=$w > "; } echo "<hr>2_"; $h = $size[1]/2; $w = $size[0]/2; for ($i=4;$i<20;$i=$i+2) { $h = $h/2; $w = $w/2; echo "<img src='../images/elephant_8.jpg' height=$h width=$w > "; } echo "<hr>3_"; $w = $size[0]/2; for ($i=4;$i<20;$i=$i+2) { $h = $size[1]/$i; $w = $w/2; echo "<img src='../images/elephant_8.jpg' height=$h width=$w > "; } echo "<hr>4_"; $h = $size[1]/2; for ($i=4;$i<20;$i=$i+2) { $w = $size[0]/$i; $h = $h/2; echo "<img src='../images/elephant_8.jpg' height=$h width=$w > "; } ?>
|
1_ 2_ 3_ 4_
|