<?php
bool imageflip ( GdImage $image, int $mode )
where,
$image = The image identifier
$mode = The flip mode
( SEE the below TABLE )
?>
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 |
<?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, 1 );
imagepng ($id_org, $dst1_img);
// VERTICAL
imageflip($id_org, IMG_FLIP_VERTICAL );
imagepng ($id_org, $dst2_img);
// HORIZONTAL & VERTICAL
imageflip($id_org, IMG_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">