-1
我要上传图片上传folder.code上载如下错误在调整大小上载
$profile_image = 'profile_image';
$this->load->library('custom_upload_lib');
//get file extension
$fileExtension = "";
if($_FILES["profile_image"]["name"]):
// "profile_image" is the form input field name
$path_info = pathinfo($_FILES["profile_image"]["name"]);
$fileExtension = $path_info['extension'];
endif;
$upload_path = './uploads/profile_image/';
$allowed_types = 'GIF|gif|PNG|png|jpg|JPEG|jpeg';
$max_size = 2048;
$encrypt = false;
$saved_file_name = "profile_".rand(2,8)
.strtotime(date('Y-m-d H:i:s')).'.'.$fileExtension;
//$saved_file_name=$_FILES["profile_image"]["name"];
$overwrite = false;
$upload_control_name = $profile_image ;
$filePath = "";
$uploadname = "";
if($fileExtension != "")
{
$upload_data = $this->custom_upload_lib->configure_upload($upload_path,
$allowed_types,$max_size,$encrypt,$saved_file_name,
$overwrite,$upload_control_name);
if(is_array($upload_data))
{
$filePath = $upload_data['full_path'];
$uploadname = 'profile_image/'.$upload_data['file_name'];
$temp_upload_name = $upload_data['file_name'];
$width = 90;
$height = 90;
$this->load->library('resize_lib');
$resize = $this->resize_lib->_resizeImage(
$filePath ,$temp_upload_name, $width, $height);
if(!$resize)
{
$message = $resize;
$this->session->set_flashdata('message', $message);
redirect(site_url('admin/preacher'));
}
}
else
{
$message = $upload_data;
$this->session->set_flashdata('message', $message);
redirect(site_url('admin/preacher'));
}
}
给予我必须将图像尺寸调整到90×90.But调整不工作..
小心解释问题?如果你说“不起作用”,我们只能回答“代码错误”。 – 2012-01-03 10:08:15
是的,请说明错误是什么,如何重现问题!你也可以把resize_lib的代码放在pastebin中,并在这里给出链接。 – HungryCoder 2012-01-03 10:41:48
用于在CI中调整大小的默认库是[Image Manipulation Class](http://codeigniter.com/user_guide/libraries/image_lib.html)。如果您不使用该库,请让我们看看您选择的库的代码。 – swatkins 2012-01-03 14:54:08