【问题标题】:file_put_contents():: failed to open stream: Permission denied, resize CODEIGNITERfile_put_contents():: 无法打开流:权限被拒绝,调整 CODEIGNITER 的大小
【发布时间】:2018-04-14 13:03:14
【问题描述】:

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

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();
    }

【问题讨论】:

    标签: php codeigniter ftp upload resize


    【解决方案1】:

    我认为它的权限问题。请授予您要存储文件的目录的写入权限。

    【讨论】:

    • 已授予完全访问权限,我正在使用 windows。
    【解决方案2】:
     chmod(UPLOAD_DIR . $name, 0644);
    

    也可以把值执行0755

    【讨论】:

    • 什么是 $name @Thoppil
    【解决方案3】:

    这是因为您的php-cgi.exe 没有写入该文件夹的权限也可能是检查您是否作为“用户”有权更改文件夹权限。

    你可以参考这个: https://www.addictivetips.com/windows-tips/windows-7-access-denied-permission-ownership/
    https://forums.iis.net/t/1167645.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-22
      • 2014-11-29
      • 1970-01-01
      • 2014-06-25
      • 2018-04-25
      • 2022-09-22
      • 1970-01-01
      相关资源
      最近更新 更多