[eluser]Thiago Leao[/eluser]
hi friends, i need help in resize and help.
UPLOAD_PRODUTO.php (View)
Code:
<?php
echo validation_errors();
echo form_open_multipart(base_url().'administracao/cad_produto/cad_img');
echo form_label('Foto do Produto', 'userfile');
echo "<input type=\"file\" name=\"userfile[]\" size=\"20\" class=\"multi\" />";
echo form_submit('mysubmit');
echo form_close();
?>
CAD_PRODUTO (controller)
Code:
function cad_img(){
$data = date("Y-m");
$dir = realpath('assets/uploads/'.$data.'/');
if(!is_dir($dir)){
mkdir($dir, 0777, TRUE);
}
$config['upload_path'] = realpath($dir);
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '500'; // in kb
$config['max_width'] = '800';
$config['max_height'] = '600';
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
$this->load->library('Multi_upload');
$this->upload->initialize($config);
$files = $this->multi_upload->go_upload();
if ( ! $files ){
$error = array('error' => $this->upload->display_errors());
$this->load->view('administracao/upload_produto', $error);
}else{
$data = array('upload_data' => $files);
$this->load->view('administracao/upload_success', $data);
}
}
the upload is being done!
But I submit that the bigger picture and still allowed to send.
Another thing, I wanted to resize to 800x600 and 75x75 generate thumb, how? I've tried
everything looked the forum and can not.
Can anyone help me?
thanks