Example #1
0
function dothumb($picpath)
{
    $arr = explode('/', $picpath);
    $filename = array_pop($arr);
    $big_name = get_big_name($filename);
    $imginfo = getImageSize($picpath);
    $imgw = $imginfo[0];
    $imgh = $imginfo[1];
    $image = new \Think\Image();
    $image->open($picpath);
    $image->save('./Public/allimage/' . $big_name);
    $image->thumb(300, 300, \Think\Image::IMAGE_THUMB_SCALE)->save('./Public/allimage/' . $filename);
    unlink($picpath);
    return $filename;
}
Example #2
0
 public function addpic($filename)
 {
     $M = M('Image');
     $big_name = get_big_name($filename);
     $data['pic'] = $filename;
     $data['big_pic'] = $big_name;
     $data['uid'] = I('session.uid');
     $data['time'] = date('Y-m-d H:i:s', time());
     if (I('session.user_sex') == '男' || I('session.user_sex') == '女') {
         $data['sex'] = I('session.user_sex');
     }
     if (I('post.phone') != null) {
         $save['phone'] = I('post.phone');
         $where['uid'] = session('uid');
         M('User')->where($where)->save($save);
     }
     $M->add($data);
 }