[英]How do you load an image from ftp and handling it with picasso library?
我想從我的ftp服務器上加載圖像,並用picasso
庫顯示它。
可能嗎 ?
這是我的代碼,但是.load()
不接受InputStream
。 有什么建議么?
try {
FTPClient mFTPClient = new FTPClient();
mFTPClient.connect("ftp.server.com");
mFTPClient.login("user","pass");
mFTPClient.enterLocalPassiveMode();
mFTPClient.changeWorkingDirectory("/public_ftp/");
inStream = mFTPClient.retrieveFileStream("18.jpg");
} catch (Exception e) {
e.printStackTrace();
System.out.println( "Error communicating with FTP server." );
}
Picasso.with(this)
.load(inStream)
.placeholder(R.drawable.local_wallpaper)
.resize(200, 200)
.centerInside()
.into(mc, new com.squareup.picasso.Callback() {
@Override
public void onSuccess() {
Log.v("", "success");
}
@Override
public void onError() {
Log.v("", "Error");
}
});
正如達米安所說, picasso
似乎不可能做到這一點。
您可以嘗試以下一些建議,
picasso
一個非常重要的功能-圖像緩存。 如果需要,您必須自己編寫代碼。 http
協議的常規映像。 RequestHandler
。 但我無法告訴您更多有關它的信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.