Flip the image horizontally in PHP

Description

The following code shows how to flip the image horizontally.

Example


<?php/* www  .j  a v a 2s .c  o  m*/
// File
$filename = 'test.png';

// Content type
header('Content-type: image/png');

// Load
$im = imagecreatefrompng($filename);

// Flip it horizontally
imageflip($im, IMG_FLIP_HORIZONTAL);

// Output
imagejpeg($im);
imagedestroy($im);
?>

The code above generates the following result.

Flip the image horizontally in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text