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
|
$width = imagesx($image_p);
$height = imagesy($image_p);
$dest3 = imagecreatetruecolor($width, $height);
$dest4 = imagecreatetruecolor($width, $height);
imagecopyresampled( $dest4,$image_p, 0, 0, 0, 0, 800, 800, $width, $height);
if ( !isset($_SESSION['Vertical']) )//je teste si la variable de session 'Vertical' existe, si elle n'existe pas je la crée (initialisation).
$_SESSION['Vertical'] = 1;
else //Si elle existe je l'incrémente de 1.
$_SESSION['Vertical']+=1;
if (($_SESSION['Vertical'])%2!= 0)
{
for($y=0;$y<$height;$y++)
{
imagecopy($dest3, $image_p, 0, $y,0, ($height - $y - 1), $width, 1);
}
imagecopyresampled($image_p, $dest3, 0, 0, 0, 0, 800, 800, $width, $height);
}
else
{
for($y=0;$y<$height;$y++)
{
imagecopy($image_p,$dest4, 0,$y,0, ($height - $y - 1),$width, 1);
}
imagecopyresampled($image_p, $dest4, 0, 0, 0, 0, 800, 800, $width, $height);
} |
Partager