Closed kunz398 closed 5 years ago
Sorry, this is not related to RichTextEditor. I'm not responsible for implementing your application logic.
I make a suggestion how to do this here, but please don't ask me any further questions to this.
I personally would use Jsoup (org.jsoup:jsoup:1.11.2) to get all \ elements from html String, use their 'src' attribute to upload the image to your server and set the url of the now uploaded image in \ element:
// don't do this on UI thread, it's a long taking operation with network access which would block your application
private void uploadImagesAndSaveHtmlToServer(final String html) {
Document doc = Jsoup.parse(html);
Elements images = doc.select("img");
for (Element imageElement : images) {
String imageUrl = imageElement.attr("src");
// uploads this image to your server and returns remote image url (= url of image on your server)
String remoteImageUrl = uploadImageToServer(imageUrl);
imageElement.attr("src", remoteImageUrl);
}
String htmlWithRemoteImageUrls = doc.outerHtml();
savetoserver(htmlWithRemoteImageUrls); // calls your savetoserver(String) method
}
i have this code at the moment
save function
savetoserver function
now my php script is simple PHP SCRIPT
so in my database it stores as a string i get that but what i want to do is if there is an image i want to download that to my server and then display it from there so the image source would be something like so
i think first i need to convert the image to string but before that i need to be able to get that image and save it as a varible in
bitmap
but i dont know how to go about this. i am fairly new at this concepts so a guide would be really helpful