function overlayjpg($imgsrc,$imgdst,$width,$height="")
{
//$imgsrc jpg格式图像路径 $imgdst jpg格式图像保存文件名 $imgwidth要改变的宽度 $imgheight要改变的高度
//取得图片的宽度,高度值
$arr = getimagesize($imgsrc);
//计算图片X轴位置
$img_X = ($width - $arr[0])/2;
if($height == ""){
$heights = $arr[1];
$img_Y = 0;
}
else{
if($height <= $arr[1]){
$heights = $arr[1];
$img_Y = 0;
}
else{
$heights = $height;
$img_Y = ($height - $arr[1])/2;
}
}
//$w = $arr[0];
//$h = $arr[1];
// Create image and define colors
$image = imagecreatetruecolor($width,$heights); //创建一个彩色的底图
$bg = imagecolorallocate($image, 255, 255, 255);
imagefill($image,0,0,$bg);
$