codeigniter上传图像与其他数据 [英] codeigniter upload image with other data
问题描述
我有一个提交表单,用户有能力以该表单上传图片,然后提交整个表单。我发现一个关于codeigniter网站的教程显示上传形式(专用于上传,而不是其他数据)。链接为: Codeigniter上传教程。
I have a form am submitting and user has the ability to upload a picture in that form then submit the form as whole. I found a tutorial on codeigniter site showing upload form (dedicated only to upload, not other data along). link is: Codeigniter Upload Tutorial. How can I submit the form and then upload the files while also uploading other details to other table in database?
推荐答案
图片MOO是一个优秀的库,可以在飞行中完成图像操作....
Image MOO is a excellent library that can accomplish image manipulations on the fly....
例如,用于将上传的图像调整到特定的路径,你只需要这样做
e.g for resizing the uploaded image to a particular path, you just have to do this
public function thumbnailer($uploader_response,$field_info,$files_to_upload)
{
$this->load->library('image_moo');
$file_uploaded=$field_info->upload_path.'/'.$uploader_response[0]->name;
$thumbnails=$field_info->upload_path.'/thumbnails/'.$uploader_response[0]->name;
$cart_thumbnails=$field_info->upload_path.'/cart_thumbnails/'.$uploader_response[0]->name;
$this->image_moo->load($file_uploaded)->resize(400,250)->save($thumbnails,false);
}
希望这有助于!
这篇关于codeigniter上传图像与其他数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!