Skip to content

Commit 063b0cd

Browse files
committed
some git geraffel
signed-off-by: niendo1 <peter@niendo.de> Signed-off-by: niendo1 <peter@niendo.de>
1 parent d79c0a2 commit 063b0cd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

richeditor/src/main/java/jp/wasabeef/richeditor/RichEditor.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public void insertImage(String url, String alt, String width, String height, Boo
507507
exec("javascript:RE.insertImage('" + url + "', '" + alt + "','" + width + "', '" + height + "', '" + relative.toString() + "');");
508508
}
509509

510-
public void insertImageAsBase64(Uri imageURI, String alt, String width, String height) {
510+
public void insertImageAsBase64(Uri imageURI, String alt, String width, String height, Boolean relative) {
511511
InputStream inputStream = null;
512512
try {
513513
inputStream = getContext().getContentResolver().openInputStream(imageURI);
@@ -521,11 +521,10 @@ public void insertImageAsBase64(Uri imageURI, String alt, String width, String h
521521
} catch (IOException e) {
522522
e.printStackTrace();
523523
}
524-
//String format = getContext().getContentResolver().getType(imageURI).toLowerCase();
525-
String format = "png";
526-
String tag = "data:image/" + format + ";charset=utf-8;base64,";
524+
String type = getContext().getContentResolver().getType(imageURI).toLowerCase();
525+
String tag = "data:" + type + ";charset=utf-8;base64,";
527526
exec("javascript:RE.prepareInsert();");
528-
exec("javascript:RE.insertImage('" + tag + Utils.toBase64(bitmap, format) + "','" + alt + "','" + width + "', '" + height + "');");
527+
exec("javascript:RE.insertImage('" + tag + Utils.toBase64(bitmap, type) + "','" + alt + "','" + width + "', '" + height + "', '" + relative.toString() + "');");
529528
//exec("javascript:RE.insertImage('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==','alt');");
530529
}
531530

0 commit comments

Comments
 (0)