/**
* 处理二维码图片
* @param string $imgsrc 二维码路径
* @param string $imgwidth 二维码宽
* @param string $imgheight 二维码高
* @param int $time 时间戳,用户名
* @return string 返回新的名字
*/
function resizejpg($imgsrc,$imgwidth,$imgheight,$time)
{
//$imgsrc jpg格式图像路径 $imgdst jpg格式图像保存文件名 $imgwidth要改变的宽度 $imgheight要改变的高度
//取得图片的宽度,高度值
$arr = getimagesize($imgsrc);
header("Content-type: image/jpg");
$imgWidth = $imgwidth;
$imgHeight = $imgheight;
$image = imagecreatetruecolor($imgWidth, $imgHeight);
$imgsrc = imagecreatefromjpeg($imgsrc);
imagecopyresampled($image, $imgsrc, 0, 0, 0, 0,$imgWidth,$imgHeight,$arr[0], $arr[1]);//复制图片
$name= $time.".jpg";
Imagejpeg($image,$name);//生成$name图片
$image = imagecreatefromjpeg($name);//创建
imagejpeg($image, null);//打开
imagedestroy ($image);//销毁
}
resizejpg('test.jpg',30,30,5555);
exit;