Flip an image vertically in PHP

Description

The following code shows how to flip an image vertically.

Example


<?php/*from   w ww  .  j a v  a2 s.  co  m*/
// File
$filename = 'test.png';

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

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

// Flip it vertically
imageflip($im, IMG_FLIP_VERTICAL);

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

The code above generates the following result.

Flip an image vertically in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text