image_lib的resize()的問題
本帖最后由 wssx 于 2011-1-20 16:19 编辑用的是swf的上傳,現在出現有的圖片能上傳,有的不能上傳,經測試發現$this->load->library('image_lib',$config);執行到這一句正常,$this->image_lib->resize()執行到這一句的時候有問題,
if (!$this->image_lib->resize())
{
$_SESSION['reg'] = 'ffff';
}else{
$_SESSION['reg'] = 'ggg';
}
發現無論如何session的值寫入不進去。請大家幫忙看看是啥問題。 贴代码。
//壓成大圖
$upload_file['b_filename'] = $save_info['path'].'/b_'.$upload_file['name'];
$config = array(
'image_library' => 'gd2',
'source_image' => $upload_file['filename'],
'maintain_ratio' => true,
'width' => 1024,
'height'=> 3000,
'new_image'=> $upload_file['b_filename']
);
$this->load->library('image_lib',$config);
if (!$this->image_lib->resize())
{
$_SESSION['reg'] = 'ffff';
}else{
$_SESSION['reg'] = 'ggg';
}
$this->image_lib->resize();
// $_SESSION['reg'] = 'eeeee';
$this->image_lib->clear();
//壓成中圖
$config = array(
'image_library' => 'gd2',
'source_image' => $upload_file['b_filename'],
'maintain_ratio' => true,
'width' => 80,
'height'=> 80,
'new_image'=> $upload_file['filename']
);
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
//壓成小圖
$upload_file['s_filename'] = $save_info['path'].'/s_'.$upload_file['name'];
$config = array(
'image_library' => 'gd2',
'source_image' => $upload_file['filename'],
'maintain_ratio' => true,
'width' => 28,
'height'=> 28,
'new_image'=> $upload_file['s_filename']
);
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
代碼如上,很多圖片在$this->image_lib->resize();執行到這裡的時候就死了。 看起来没什么问题 -_-
有什么报错吗? 回复 4# Hex
if (!$this->image_lib->resize())
{
$_SESSION['reg'] = 'ffff';
}else{
$_SESSION['reg'] = 'ggg';
}
這個session的值一直是空的。這個讓我感覺很不理解! 如果不加$this->image_lib->resize()這句什麽圖片都能上傳成功,加上之後有的圖片就上傳不了,而且不能上傳的圖片也沒有規律可循 目前说不好是什么造成的,可能和你的服务器环境有关。 現在加了個圖片尺寸的判斷,發現昨天不能上傳的圖片可以上傳了。而且進的的代碼是帖子中貼的的代碼,實在是無語了。 肯定不是服務器的問題,現在我這個案子上傳圖片的模塊有6個,就發現這一個有問題。
页:
[1]