PHP | imageflip()函数

这个 imageflip() 函数是PHP中的一个内置函数,用于使用给定模式水平、垂直或水平和垂直翻转图像。

null

语法:

bool imageflip( $image, $mode )

参数: 该函数接受两个参数,如下所述:

  • $image: 这个 imagecreatetruecolor() 函数用于创建给定大小的空白图像。
  • $mode: 此参数用于保持图像的翻转模式。这可以是IMG_FLIP_*常量之一:
    • IMG_翻转_水平- 水平翻转图像。
    • IMG_翻转_垂直- 垂直翻转图像。
    • IMG_FLIP_两者—— 水平和垂直翻转图像。

返回值: 此函数在成功时返回TRUE,失败时返回FALSE。

下面的程序说明了 imageflip() 函数。

注: 下面给出的图像用于以下程序。 图片[1]-PHP | imageflip()函数-yiteyi-C++库

项目1:

<?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 );
?>


输出: image flip

项目2:

<?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 );
?>


输出: flip image

方案3:

<?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 );
?>


输出: image flip

相关文章:

参考: http://php.net/manual/en/function.imageflip.php

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享