Home  >  Article  >  Backend Development  >  图象翻转_PHP

图象翻转_PHP

WBOY
WBOYOriginal
2016-06-01 12:40:06964browse

/**
flip 图象翻转
**/

$image = "images/csdn.gif"; // 原图
$imgstream = file_get_contents($image);
$im = imagecreatefromstring($imgstream);

$thumbw = imagesx($im); // 原图宽
$thumbh = imagesy($im); // 原图高

if(function_exists("imagecreatetruecolor"))
$dim = imagecreatetruecolor($thumbw, $thumbh); // 创建目标图gd2
else
$dim = imagecreate($thumbh, $thumbw); // 创建目标图gd1
for($x=0;$x for($y=0;$y// imagecopyresized($dim,$im,$thumbw-$x-1,$y,$x,$y,1,1,1,1); //水平翻转
imagecopyresized($dim,$im,$x,$thumbh-$y-1,$x,$y,1,1,1,1); //垂直翻转
}


header ("Content-type: image/jpeg");
imagejpeg ($dim);
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn