I have a project that I wanna use codeigniter to resize the uploaded image and save to a remote server
I can successfully do the following(all on my local machine):
- get the uploaded images
- save to a tmp folder
- resize the image in the tmp folder
- save to the final destination folder.
However, I wanna make one more step further. I wanna get the image from tmp, resize it and save to a remote server. here is the sample code I assume it wont work.
$config['image_library'] = 'gd2';
$config['source_image'] = '/tmp/sample.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 80;
$config['height'] = 60;
$config['new_image'] = 'ftp://xx.xx.xxx.xxx/tmp/sample.jpg'; // can i do this?
$config['thumb_marker'] = '';
$ftpconfig['hostname'] = 'xx.xx.xxx.xxx';
$ftpconfig['username'] = 'name';
$ftpconfig['password'] = 'password';
$ftpconfig['debug'] = TRUE;
$this->ftp->connect($ftpconfig);
// and can I call CI to resize it and save to a ftp server after connent ftp?
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
$this->ftp->close();
you need to upload file, right now you are not using upload method of FTP library file after saving on your server you have to upload
please check user guide for ftp class