imageflip
(PHP 5 >= 5.5.0, PHP 7)
imageflip - 使用给定模式翻转图像
描述
bool imageflip ( resource $image , int $mode )
image
使用给定的翻转图像mode
。
参数
`image`
一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。
mode
翻转模式,这可以是IMG_FLIP_*
常数之一:
不变 | 含义 |
---|---|
IMG_FLIP_HORIZONTAL | 水平翻转图像。 |
IMG_FLIP_VERTICAL | 垂直翻转图像。 |
IMG_FLIP_BOTH | 水平和垂直翻转图像。 |
返回值
返回TRUE
成功或失败时返回FALSE
。
例子
Example #1 Flips an image vertically
这个例子使用IMG_FLIP_VERTICAL
常量。
<?php
// File
$filename = 'phplogo.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);
?>
上面的例子会输出类似于:

Example #2 Flips the image horizontally
这个例子使用IMG_FLIP_HORIZONTAL
常量。
<?php
// File
$filename = 'phplogo.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);
?>
上面的例子会输出类似于:

← imagefilter
imagefontheight →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com