2013-09-28 2 views
1
String imageFilePath = "ftp://hostname/dir/imagefilename.jpg"; 
BitmapFactory.Options options = new BitmapFactory.Options; 
options.inJustDecodeBounds = true; 
BitmapFactory.decodeFile(imageFilePath, options); 
int height = options.outHeight; 
int width = options.outWidth; 

그러나 heightwidth 항상 0있는 FTP 서버에서 이미지 파일 BitmapFactory.Options 0입니다.outWidth 및 outHeight는

또한 inJustDecodeBounds = false을 설정하여 시도했지만 여전히 decodeFile 메서드는 null을 반환합니다.

imageFilePath을 로컬 이미지 파일로 설정하면 다시 작동하고 다시 http 웹 사이트의 파일에 대해을 처리하지 못했습니다.

FTP 서버에 연결하는 데 궁금한 사람들은 성공적으로 연결되고 인증되며 심지어는 FTPClient.listFiles()FTPClient.listNames()을 사용하여 모든 이미지 파일과 이름을 올바르게 가져옵니다.

답변

0

파일 경로는 외부 파일 서버에서 호스팅되는 것이 아니라 로캘 파일입니다. 파일을 직접 다운로드하거나 Universal Image Loader 또는 Picasso와 같은 라이브러리를 사용해야합니다. 비록 그들이 ftp로 얼마나 잘 작동하는지 모르겠지만 (

)