这是我的观看文件
<div class="form-group">
<label>Select Package Image(Large) </label>
<?= form_input(array('type'=>'file','id'=>'pkg_img','name'=>'pkg_img','class'=>'form-control','multiple'=>'')); ?>
</div>
<div class="form-group">
<label>Select Package Image(Mediam)</label>
<?= form_input(array('type'=>'file','id'=>'pkg_img_md','name'=>'pkg_img_md','class'=>'form-control','multiple'=>'')); ?>
</div>
<div class="form-group">
<label>Select Package Image(Small)</label>
<?= form_input(array('type'=>'file','id'=>'pkg_img_sm','name'=>'pkg_img_sm','class'=>'form-control','multiple'=>'')); ?>
</div>
答案 0 :(得分:0)
使用Html助手类
t.test(c(11, 14, 15, 17, 15, 14, 9, 17, 10, 12),c(5, 10, 6, 13, 6, 13, 7, 10, 14, 11), paired=TRUE)
答案 1 :(得分:0)
假设您只想以不同(小,中)尺寸调整相同图像的大小,可以使用以下代码。如果这不是你想要完成的,你可以根据自己的喜好进行修改:
class Test extends CI_Controller {
public function index() {
$this->load->helper('form');
echo form_open_multipart('/test/upload_image/');
echo form_upload('userfile');
echo form_submit(array('name' => 'add_file', 'value' => 'Add File'));
}
public function upload_image() {
if (!is_dir('./uploads/')) {
mkdir('./uploads/', 0755);
}
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|bmp';
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload('userfile')) {
// handle this with flash messages & redirect
exit($this->upload->display_errors());
}
$image = $this->upload->data();
$this->load->library('image_lib');
$config = array(); // reset config array
$config['image_library'] = 'gd2';
$config['source_image'] = $image['full_path'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = FALSE;
$config['thumb_marker'] = '';
$config_sm['new_image'] = "./uploads/{$image['raw_name']}_sm{$image['file_ext']}";
$config_sm['width'] = 50;
$config_sm['height'] = 50;
$this->image_lib->initialize(array_merge($config, $config_sm));
$this->image_lib->resize();
$this->image_lib->clear();
$config_md['new_image'] = "./uploads/{$image['raw_name']}_md{$image['file_ext']}";
$config_md['width'] = 100;
$config_md['height'] = 100;
$this->image_lib->initialize(array_merge($config, $config_md));
$this->image_lib->resize();
$data = array(
'pkg_img_sm' => $config_sm['new_image'],
'pkg_img_md' => $config_md['new_image'],
'pkg_img' => $image['full_path'],
);
print_r($data);
//$this->db->insert('sometable', $data);
}
}
将生成一个类似于:
的数组Array ( [pkg_img_sm] => ./uploads/936174c69e709b4c6d7fb840c4094eba_sm.jpg [pkg_img_md] => ./uploads/936174c69e709b4c6d7fb840c4094eba_md.jpg [pkg_img] => C:/xampp/htdocs/uploads/936174c69e709b4c6d7fb840c4094eba.jpg )