ich hochladen Bild auf Server mit Hilfe von Volley und Bitmap und ich erfolgreich übergeben die Daten, aber wenn ich das Bild mit Kamera die Bildqualität wird so schlecht und auch wann Ich übergebe ein Bild der Größe über 500kb die App stürzt ab. Warum passiert das? kann mir jemand helfen,wie Bild mit Text auf den Server hochladen, ohne die Bildqualität zu beeinträchtigen,
dies ist, wie meine Kamera Absicht ausführen
private void onCaptureImageResult(Intent data) {
thumbnail = (Bitmap) data.getExtras().get("data");
File destination = new File(Environment.getExternalStorageDirectory(),
System.currentTimeMillis() + ".jpg");
FileOutputStream fo;
try {
destination.createNewFile();
fo = new FileOutputStream(destination);
//fo.write(bytes.toByteArray());
fo.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (thumbnail!=null){
addImageNew.setImageBitmap(thumbnail);
}
}
dies ist, wie meine Galerie Absicht
private void onSelectFromGalleryResult(Intent data) {
thumbnail=null;
if (data != null) {
try {
thumbnail = MediaStore.Images.Media.getBitmap(getApplicationContext().getContentResolver(), data.getData());
} catch (IOException e) {
e.printStackTrace();
}
}
if (thumbnail!=null){
addImageNew.setImageBitmap(thumbnail);
}
}
diese ausführen, wie ich Bitmap-String konvertieren
public String getStringImage(Bitmap bmp){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 90, baos);
byte[] imageBytes = baos.toByteArray();
String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
return encodedImage;
}
HINWEIS: Ich habe nur ein Problem in der Bildqualität und hohe Bildgröße g
danken Ihnen für Ihre Antwort, aber ich kann meine problm – Sam