图象翻转 - 编程吧

上一篇 | 下一篇

图象翻转

发布: 2006-8-18 09:19 | 作者: 未知 | 来源: 未知 | 查看: 45次

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

TAG: 编程

字号: | 推荐给好友

 

评分:0

我来说两句

seccode