| 01 | | | 02 | | | 03 | | | 04 | | | 05 | | | 06 | | | 07 | | | 08 | | | 09 | | | 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 | |
|
/*---------------------------------------------------------------*/
| /*
| Titre : Rotation image
|
| URL : https://phpsources.net/code_s.php?id=961
| Date édition : 15 Fev 2019
| */
| /*---------------------------------------------------------------*/
|
| function rotation($pic , $angle){
| /* Paramètres :
| * $pic : identifiant d'image obtenu par imagecreate()
| * $angle : angle de rotation (90°, 180°, 270°)
| */
| $width = imagesx($pic);
| $height = imagesy($pic);
| if ($angle==180)
| $p = imagecreate($width, $height);
| else
| $p = imagecreate($height, $width);
| if ($angle<0)
| $angle = 360 + $angle % 360;
| if ($angle>360)
| $angle = $angle % 360;
|
| if ($angle==180)
| {
| for($i=0;$i<$width;$i++)
| for($j=0;$j<$height;$j++)
| imagecopy($p, $pic, $i, $j, $width-$i, $height-$j, 1, 1);
| return $p;
| }
| if ($angle==270)
| {
| for($i=0;$i<$width;$i++)
| for($j=0;$j<$height;$j++)
| imagecopy($p, $pic, $j, $i, $width-$i, $j, 1, 1);
| return $p;
| }
| if ($angle==90)
| {
| for($i=0;$i<$width;$i++)
| for($j=0;$j<$height;$j++)
| imagecopy($p, $pic, $j, $i, $i, $height-$j, 1, 1);
| return $p;
| }
| return $pic;
| }
|
| | ?> |
|