代码语言:javascript复制
$base64img1 = split(';', $this_img);
$base64img = split('/',$base64img1[0]);
$imgname = date('ymdHis') . time() . '.' . array_pop($base64img);
print_r($imgname);
$save_src = '..\\update\\Blog\\' . $imgname;
$width = 270;
$height = 167;
$image = ImageCreateFromJPEG($this_img);
$imagewidth = ImageSX($image);
$imageheight = ImageSY($image);
$newimg = ImageCreateTrueColor($width, $height);
ImageCopyResized($newimg, $image, 0, 0, 0, 0, $width, $height, $imagewidth, $imageheight);
ImageJpeg($newimg, $save_src);//savesrc为你的略缩图储存路径
return;