Czesc.
Mam tutaj problem, ponieważ po wrzucaniu plikow nie konwertuje do jpg - wrzuca wszystkie pliki/formaty: png, gif a ma tylko jpg
Gdzie leży problem?
public function img()
{
if ($this->input->post('add'))
{
unlink('public/uploads/'.$this->session->userdata('user_id').'.jpg'); $config['upload_path'] = './public/uploads/';
$config['allowed_types'] = 'jpg|gif|png';
$config['max_size'] = '2048';
$config['max_width'] = '0';
$config['max_height'] = '0';
$config['file_name'] = $this->session->userdata('user_id');
$this->upload->initialize($config);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('file'))
$this->session->set_flashdata('error', 'Wystąpił błąd, spróbuj ponownie.');
else
{
$config['image_library'] = 'gd2';
$filepath = $data['full_path'];
$config['source_image'] = $filepath;
$config['new_image'] = $filepath.$this->session->userdata('user_id').'.jpg';
$config['maintain_ratio'] = FALSE;
$config['width'] = 150;
$config['height'] = 100;
$config['master_dim'] = 'auto';
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$imagetype = $data['image_type'];
if ($imagetype != 'jpeg')
}
redirect('profile/img');
}
else
$this->load->view('profileavatar');
}