PHP | imageflip() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes 1 Likes Like Report The imageflip() function is an inbuilt function in PHP which is used to Flip an image horizontally, vertically or both horizontally and vertically using the given mode. Syntax: bool imageflip( $image, $mode ) Parameters: This function accepts two parameters as mentioned above and described below: $image: The imagecreatetruecolor() function is used to create a blank image in a given size. $mode: This parameter is used to hold the Flip mode of image. This can be one of the IMG_FLIP_* constants: IMG_FLIP_HORIZONTAL - Flips the image horizontally. IMG_FLIP_VERTICAL - Flips the image vertically. IMG_FLIP_BOTH - Flips the image both horizontally and vertically. Return Value: This function returns TRUE on success or FALSE on failure. Below programs illustrate the imageflip() function in PHP. Note: The image given below is used in the following program. Program 1: php <?php // Assign image file in variable. $image_name = 'geeks.png'; // Load image file $image = imagecreatefrompng($image_name); // Flip the image vertically imageflip($image, IMG_FLIP_VERTICAL); // Content type header('Content-type: image/png'); // Output imagejpeg($image); ?> Output: Program 2: php <?php // Assign image file to variable $image_name = 'geeks.png'; // Load image file $image = imagecreatefrompng($image_name); // Flip the image horizontally imageflip($image, IMG_FLIP_HORIZONTAL); // Content type header('Content-type: image/png'); // Output imagejpeg($image); ?> Output: Program 3: php <?php // Assign image file to variable $image_name = 'geeks.png'; // Load image file $image = imagecreatefrompng($image_name); // Flip the image file both horizontally // and vertically. imageflip($image, IMG_FLIP_BOTH); // Content type header('Content-type: image/png'); // Output imagejpeg($image); ?> Output: Related Articles: PHP | imagedashedline() Function PHP | imagefilledpolygon() Function PHP | imagefilledellipse() Function Reference: https://www.php.net/manual/en/function.imageflip.php Comment V Vishal_Khoda Follow 1 Improve V Vishal_Khoda Follow 1 Improve Article Tags : Misc Web Technologies PHP PHP-function Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like