0
不明白爲什麼這個圖片大小不工作請幫助笨調整圖片大小不工作
//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);
}