codeigniter - How to read images from a remote sftp file server -


so i'm using codeigniter php framework website. have few servers, live, dev, , file server. we've been able upload files our dev server, , secure copy them our file server storage. our problem way read/display images on our dev website file server. our file server uses sftp it's security. we've been looking different ways pass image object file server, not actual file. suggestions on how this? thanks.

codeigniter php framework linux servers sftp on file server

thanks...

well, have not dealed sftp @ lest try give steps begin.

  1. you need install apache/php module ssh2 , enable extension=php_ssh2.dll.

  2. you make own sftp library, this:

    class sftp{

    protected $connection;  public function __construct($params)     {      }      public function connect()     {     $server = "you-server.com";     $port = "1234";     $username = "admin";     $password = "blabla";      //connect     $ssh2 = ssh2_connect($server, $port);      if(ssh2_auth_password($ssh2, $username, $password))     {         //sftp session         $this->connection = ssh2_sftp($resconnection);     }     else     {         echo "unable connect server";     }     }  public function download($image_name) {     $image = fopen("ssh2.sftp://{$this->connection}/path/to/{$image_name}", 'r');     fclose($image); }  } 

and try use like:
$this->sftp->connect(); $image = $this->sftp->download('image-name');


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -