我有一个项目,我想使用代码点火器来调整上传图像的大小,并保存到远程服务器。
我可以成功地完成以下操作(全部在本地计算机上):
不过,我还想再走一步。我想从tmp中获取映像,调整大小并保存到远程服务器。下面是我假设的示例代码,它不起作用。
$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();发布于 2012-11-07 07:19:06
你需要上传文件,现在你不使用FTP库文件的上传方法,在你的服务器上保存后,你必须上传
$this->ftp->upload('/local/path/to/myfile.html', '/public_html/myfile.html', 'ascii', 0775);请查看ftp类的用户指南。
https://stackoverflow.com/questions/13264121
复制相似问题