2014-11-21 71 views
0

我使用Base64格式將圖像字符串從android發送到Php服務器。但在服務器端,完整的圖像不顯示。僅顯示圖像的一部分上部。我使用下面的代碼如下使用Base64格式將圖像編碼爲字符串

Bitmap bitmap2 = BitmapFactory.decodeFile(fileUri.getPath(), options);   
    ByteArrayOutputStream stream = new ByteArrayOutputStream(); 
    bitmap2.compress(Bitmap.CompressFormat.PNG, 90, stream); 
    byte [] byte_arr = stream.toByteArray(); 

    String image_str = Base64.encodeToString(byte_arr, Base64.DEFAULT); 
    System.out.println("image_str >>>> " + image_str); 

在這裏我捕捉照片,然後發送到服務器。我也reffer Image not encoded successfully,但我沒有得到解決辦法。

謝謝。

請幫幫我。從這裏Base64

回答

0

下載的Base64類和替換它,並再次嘗試

+0

我應該更換哪個班?我的意思是,你在談論圖書館嗎? – user3816185 2014-11-21 07:54:51

+0

而不是使用android.util.base64從這個庫使用base64類 – 2014-11-21 08:18:23

+0

這是否幫助你? – 2014-11-21 10:27:26

相關問題