首页 文章

file_put_contents()::无法打开流:权限被拒绝,调整CODEIGNITER的大小

提问于
浏览
0

Controller :这里我想调整存储在另一台服务器上的图像的大小,但是这里我得到了权限被拒绝的错误 . 我该如何解决这个问题?提前致谢 .

public function img_r()
    {   

        $image = "https://lh3.googleusercontent.com/omjb1vMWKKK3dvcZKGjHbx_zp-cwOgP7zT4blbLLS1BsIpq7JC8dgRYCXG73Ghwst8QXrSodAEl54vCwljdky06-";
        $data = file_get_contents($image);

        /*store image in server*/
        $new  = FCPATH."assets\img";

        /*Write the contents back to a new file*/
        file_put_contents($new,$data);
        $config['image_library'] = 'gd2';
        $config['source_image'] = $new;
        $config['create_thumb'] = TRUE;
        $config['maintain_ratio'] = TRUE;
        $config['width']    = 700;
        $config['height']   = 450;
        $config['new_image'] = FCPATH."assets\uploads".$image;
        $config['thumb_marker'] = '_thumb';
        $this->load->library('image_lib', $config); 
        $this->image_lib->resize();
    }

3 回答

相关问题