php略缩图

xiaoxiao2021-02-27  152

2017.08.05

项目需要处理图片,形成略缩图。然后使用的tp5自带的图像处理类,当然网上也找了一些所谓的经典万用工具类,最后结果是:工具类和tp5只能创建略缩图,不能添加新的文件夹。这一点也不工具类。

/** * 略缩图 * @param unknown $img_url 图片路径 20170101/xxx.jpg */ public function thumb($img_url){ $root = __UPLOAD__.'/images/'; $url2 = '160/'; $img = Image::open($root.$img_url); $fileUtil = new FileUtil(); $fileUtil->createDir($root.$url2.date('Ymd')); $img->thumb(160, 160)->save($root.$url2.$img_url); }

网上找的php文件工具类:

转载请注明原文地址: https://www.6miu.com/read-15080.html

最新回复(0)