I'm using codeigniter and i want to resize image from user that upload via url.
Here is my code:
//upload via url
$url = $this->input->post('photo');
/* Extract the filename */
$filename = substr($url, strrpos($url, '/') + 1);
/* Save file wherever you want */
file_put_contents('myuploads/'.$filename, file_get_contents($url));
//resize start
$config['image_library'] = 'gd2';
$config['source_image'] = $filename;
$config['overwrite'] = TRUE;
$config['width'] = 59;
$config['height'] = 90;
$this->load->library('image_lib', $config);
$this->image_lib->initialize($config);
$this->image_lib->resize();
$data=array(
'username'=>$this->input->post('username'),
'deskrip'=>$this->input->post('deskrip'),
'photo'=>$filename
);
$this->db->where('id',$id);
$outp = $this->db->update('user',$data);
Upload is working but the problem is the image won't resize into 59x90 and still in original size.
Any answer?
Many thanks..