wenxinphp

list($width, $height)=getimagesize($filename);
//缩放比例
$per=round(400/$width,3);

$n_w=$width*$per;
$n_h=$height*$per;
$new=imagecreatetruecolor($n_w, $n_h);
$img=imagecreatefromjpeg($filename);
//copy部分图像并调整
imagecopyresized($new, $img,0, 0,0, 0,$n_w, $n_h, $width, $height);
//图像输出新图片、另存为
imagejpeg($new, "a.jpg");
imagedestroy($new);
imagedestroy($img);

分类:

技术点:

相关文章:

  • 2021-07-19
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-31
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-07-05
相关资源
相似解决方案