CodeIgniter Forums

Full Version: uploading class - change upload data array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

PHP Code:
$this->upload->data(); 

After upload, i check the file width, if it is more than 500, then i resize it. 

PHP Code:
if($this->image_lib->resize()) {
$this->upload->data()['file_name'] = $this->upload->data()['raw_name']."_thumb.".$this->upload->data()['file_ext'];
}

return 
$this->upload->data(); 


But it is not chaning the file name. So i am getting upload data. If there is a resize, how to change or get the resized file properties? 
You can't change output of function directly, you need to save it to variable first, otherwise it will always return same output.
PHP Code:
$data $this->upload->data();
if(
$this->image_lib->resize()) {
    
$data['file_name'] = $data['raw_name']."_thumb.".$data['file_ext'];
}
return 
$data
Thanks for the help Wink