首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >codeigniter镜像调整不起作用

问codeigniter镜像调整不起作用
EN

Stack Overflow用户
提问于 2011-02-27 18:31:52
回答 1查看 1.2K关注 0票数 1

我不明白为什么这个图像不能调整大小请帮助

代码语言:javascript
复制
//updating article

function updateArticle(){
$data = array(
    'a_title'           =>$_POST['a_title'],
    'a_description'     =>$_POST['a_description'],
    'a_flash_news'      => $_POST['a_flash_news'],
    'a_content'         =>$_POST['a_content'],
    //'a_views'             => $_POST['a_views'],
    'a_image_caption'   =>$_POST['a_image_caption'],
    'a_audio_caption'   =>$_POST['a_audio_caption'],
    'a_video'           =>$_POST['a_video'],
    'a_video_caption'   =>$_POST['a_video_caption'],
    'a_channel'         =>$_POST['a_channel'],
    'a_grouping'        =>$_POST['a_grouping'],
    'a_status'          =>$_POST['a_status'],
    'a_breaking'        =>$_POST['a_breaking'],
    'a_hot'             =>$_POST['a_hot'],
    'a_category_id'     =>$_POST['a_category_id'],
    'a_featured'        =>$_POST['a_featured'],
    'a_tags'            =>$_POST['a_tags'],
    'a_author'          =>$_POST['a_author'],
    'a_date'            =>$_POST['a_date']
    );


    //UPLOAD IMAGE
    //some $config vars for image
    $config['upload_path'] = './images/articles';
    $config['allowed_types'] = 'gif|jpg|jpeg|png';
    $config['max_size'] = '0';
    $config['remove_spaces'] = true;
    $config['overwrite'] = false;
    $config['max_width'] = '0';
    $config['max_height'] = '0';

    //for image resize
    $config['image_library'] = 'gd2';
    $config['maintain_ratio'] = TRUE;
    $config['width'] = 320;
    $config['height'] = 320;

    $this->load->library('upload', $config);
    $this->load->library('image_lib', $config);
    $this->image_lib->resize();
    //upload main image
    if(!$this->upload->do_upload('a_image')){
        //$e = $this->upload->display_errors();
        //print_r($e);
    }

    $image = $this->upload->data();
    if($image['file_name']){
        $data['a_image'] = "images/articles/". $image['file_name'];
    }


    //UPLOAD THUMBNAIL
    unset($config);

    //now upload thumb
    //some $config vars for thumb
    $config['upload_path'] = './images/articles/thumb';
    $config['allowed_types'] = 'gif|jpg|jpeg|png|wav';
    $config['max_size'] = '0';
    $config['remove_spaces'] = true;
    $config['overwrite'] = false;
    $config['max_width'] = '0';
    $config['max_height'] = '0';    
    $this->upload->initialize($config);

        if(!$this->upload->do_upload('a_thumbnail')){
        //$e = $this->upload->dispaly_errors();
        //print_r($e);exit();   
    }       

    $thumb = $this->upload->data();
        if($thumb['file_name']){
        $data['a_thumbnail'] = "images/articles/thumb/". $thumb['file_name'];
    }


    //UPLOAD AUDIO
    unset($config);

    //now upload thumb
    //some $config vars for thumb
    $config['upload_path'] = './audio';
    $config['allowed_types'] = 'mp3|gif|jpg|jpeg|png|wav';
    $config['max_size'] = '0';
    $config['remove_spaces'] = true;
    $config['overwrite'] = false;
    $config['max_width'] = '0';
    $config['max_height'] = '0';    
    $this->upload->initialize($config);

        if(!$this->upload->do_upload('a_audio')){
        //$e = $this->upload->dispaly_errors();
        //print_r($e);exit();   
    }       

    $thumb = $this->upload->data();
        if($thumb['file_name']){
        $data['a_audio'] = "audio/". $thumb['file_name'];
    }

    //goes at last
    $this->db->where('id',$_POST['id']);
    $this->db->update('articles', $data);

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-02-11 06:59:41

你得到了什么错误?

是否拥有上传路径777的权限?

我认为如果你需要修改图片,你需要在上传路径上设置777权限。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5132668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档