[eluser]learning_php[/eluser]
Hi,
I have created a file upload that puts the images into a folder but I am unsure how to get the images into an array and display them in rows.
Code:
<?PHP
class uploadimg extends Controller {
function uploadimg()
{
parent::Controller();
}
function index(){
$this->load->view('upload');
}
function do_upload()
{
// Image configuration
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['overwrite'] = FALSE;
$config['max_size'] = 2048;
$this->load->library('upload', $config);
if(!$this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload', $error);
}
else
{
$image = $this->upload->data();
$data['image'] = "./uploads/".$image['file_name'];
$config['image_library'] = 'gd2';
$config['source_image'] = $data['image'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 150;
$config['height'] = 150;
$config['new_image'] = "./uploads/".$image['file_name'];
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_suc', $data);
}
}
}