CodeIgniter Forums
Crop image on upload - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Crop image on upload (/thread-15418.html)

Crop image on upload - El Forum - 02-03-2009

I'm following the sample code that the CI documentation provides.

My view is spitting out an array appropriately, and now what I'm interested in is the file name that just uploaded:

[file_name] => mypic.jpg

So, into the image manipulation class...
$config['image_library'] = 'gd2';
$config['source_image'] = '/path/to/image/mypic.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;

$this->load->library('image_lib', $config);


I need the source_image to be the image I just uploaded.

So, I tried this script:

$config['source_image'] = './uploads/'{what goes here?}

I'm not quite sure what to append on to the end of it so that it grabs the file name of the file I just uploaded....

Thanks for the help Smile

Crop image on upload - El Forum - 02-04-2009

Let me re-ask in an easier question Smile

how do I get the file_name out of this code:

$data = array('upload_data' => $this->upload->data());

Crop image on upload - El Forum - 02-04-2009

According to the user guide the function
serves the data of the uploaded file, so you should get the
filename by:
$filename_just_uploaded = $data['file_name'];

referring to your posted line:
$data = array('upload_data' => $this->upload->data());

Hope that work for you ..