thinkphp 缩略图

//大图路径(此处大图路径可参考上篇 “使用ThinkPHP实现附件上传”的上传路径)
$bigimg_path = $upload ->rootPath. $file_info [ 'savepath' ]. $file_info [ 'savename' ];
//小图路径
$smallimg_path = $upload ->rootPath. $file_info [ 'savepath' ]. 'small_' . $file_info [ 'savename' ];
  
$img = new \Think\Image(); //实例化
$img ->open( $bigimg_path ); //打开被处理的图片
$img ->thumb(100,100); //制作缩略图(100*100)
$img ->save( $smallimg_path ); //保存缩略图到服务器 

猜你喜欢

转载自blog.csdn.net/wyj1122/article/details/78743507
今日推荐