imageflip 


gd apg

FLIPS an image using a given mode.





This function returns TRUE on success or FALSE on failure.



<?php

bool imageflip 
GdImage $imageint $mode )


where,

$image The image identifier

$mode 
The flip mode
              
SEE the below TABLE )

?> 

  $image   


The image identifier.



  $mode   


The flip mode. One of the constants:

CONSTANT VALUE MEANING
IMG_FLIP_HORIZONTAL 1 Flips the image horizontally
IMG_FLIP_VERTICAL 2 Flips the image vertically
IMG_FLIP_BOTH 3 Flips the image both horizontally and vertically
ed48


  1 EXERCISE   

<?php

echo 'PHP VERSION: ' PHP_VERSION '<br><br>';

$tst_img  "png/PNG 048 01.png";
$dst1_img "png/PNG 048 01-horizontal flip.png";
$dst2_img "png/PNG 048 01-vertical flip.png";
$dst3_img "png/PNG 048 01-horizontal & vertical flip.png";

echo 
$tst_img?><br>EXISTING IMAGE
<br><br><img src="<?php echo  
$tst_img?>" alt="<?php echo $tst_img?>" width="400"><br><br><br><br>

<?php
$id_org 
imagecreatefrompng$tst_img);

// HORIZONTAL
imageflip($id_org);
imagepng ($id_org,  $dst1_img);

// VERTICAL
imageflip($id_orgIMG_FLIP_VERTICAL );
imagepng ($id_org,  $dst2_img);

// HORIZONTAL & VERTICAL
imageflip($id_orgIMG_FLIP_BOTH );
imagepng ($id_org,  $dst3_img);

echo 
$dst1_img?><br>FLIP HORIZONTAL
<br><br><img src="<?php echo  
$dst1_img?>" alt="<?php echo $dst1_img?>" width="400"><br><br>


<?php echo $dst2_img?><br>FLIP VERTICAL
<br><br><img src="<?php echo  
$dst2_img?>" alt="<?php echo $dst2_img?>" width="400"><br><br>

<?php echo $dst3_img?><br>FLIP BOTH
<br><br><img src="<?php echo  
$dst3_img?>" alt="<?php echo $dst3_img?>" width="400">


 RESULT   

PNG 048 01.png

EXISTING IMAGE

PNG 048 01.png apr


PNG 048 01-horizontal flip.png

FLIP HORIZONTAL

PNG 048 01-horizontal flip.png apr


PNG 048 01-vertical flip.png

FLIP VERTICAL

PNG 048 01-vertical flip.png apr


PNG 048 01-horizontal & vertical flip.png

FLIP BOTH

PNG 048 01-horizontal & vertical flip.png apr