html5中文学习网

您的位置: 首页 > 网络编程 > PHP编程 » 正文

图象翻转_PHP教程_编程技术

[ ] 已经帮助:人解决问题
<?php
/**
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<$thumbw;$x++)
for($y=0;$y<$thumbh;$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);
?>

hfkHTML5中文学习网 - HTML5先行者学习网
hfkHTML5中文学习网 - HTML5先行者学习网
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助