Home  >  Article  >  Backend Development  >  thinkphp中图片处理

thinkphp中图片处理

WBOY
WBOYOriginal
2016-06-23 13:40:311269browse

 foreach($info as $file){      
$cc=$data['img'] = $file['savename'];
echo basename('./Uploads/42.jpg','.jpg');

$image->open('./Uploads/ 图片名称.jpg');
$image->thumb(150, 150)->save('./Uploads /图片名称.jpg');
$User = M("User");  
$User->where("id='{$aa}'")->save($data);
$this->success('上传成功', 'cc');

我想要把上传的图片进行修改,不知道在 图片名称位置处写什么


回复讨论(解决方案)

open打开原图,$file['savename']
至于缩略图命名,简单的在后面加个单词,或是写个通用函数,根据原图文件名去生成也行

open打开原图,$file['savename']
至于缩略图命名,简单的在后面加个单词,或是写个通用函数,根据原图文件名去生成也行




$image->open('./Uploads/$file['savename'].jpg');是这个意思么?

$bb=$file['savepath'].$file['savename'];
$image->open($bb);
$image->thumb(150, 150,\Think\Image::IMAGE_THUMB_CENTER)->save($bb);
最后这样子解决了。。。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn