2012-11-07 5 views
0

내가 업로드 된 이미지 크기를 조정하고CodeIgniter의 이미지 크기를 조정하고 원격 서버에 저장

내가 성공적으로 다음을 수행 할 수 원격 서버에 저장하는 내가 사용하는 CodeIgniter의 싶어 프로젝트가 (내 로컬 컴퓨터에있는 모든) :

  1. 은 최종 목적지 폴더에 저장되는 TMP 폴더
  2. 에서 이미지를 크기를 조정 TMP 폴더
  3. 에 저장되는 업로드 된 이미지
  4. 를 얻을.

그러나, 나는 한 단계 더 만들고 싶어. 내가 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(); 
+0

http://stackoverflow.com/questions/13154787/image-resize-before-uploading-in-codeigniter-php/13155566#13155566이 내 대답을 확인, 당신도 거기에 코멘트를 읽어 들일 필요가 있습니다. 그것은 당신이 원하는 것을합니다. –

답변

1

당신은 당신이

$this->ftp->upload('/local/path/to/myfile.html', '/public_html/myfile.html', 'ascii', 0775); 

는 FTP 클래스

에 대한 사용자 설명서를 확인하시기 바랍니다 업로드해야 지금 당신은 당신의 서버에 저장 한 후 FTP 라이브러리 파일의 업로드 방법을 사용하지 않는 파일을 업로드해야
관련 문제