当图片上传成功后,调用如下函数
public function thumbImg(imgPath,width=255,$height=255){
$Image=new \Think\Image(1,$imgPath);
$Image->thumb($width,$height);
$rs=$Image->save($imgPath);
}
图片处理与缩放
本文介绍了一种使用Think Image库进行图片处理的方法。具体来说,该方法能够在图片上传成功后,通过调用特定函数实现图片的缩放。此函数允许指定目标宽度和高度,默认尺寸为255像素。
当图片上传成功后,调用如下函数
public function thumbImg(imgPath,width=255,$height=255){
$Image=new \Think\Image(1,$imgPath);
$Image->thumb($width,$height);
$rs=$Image->save($imgPath);
}

被折叠的 条评论
为什么被折叠?