-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add image from storage #2
Comments
You're definitely right, there's a button missing to add an image from local storage. But actually I don't think that it's a good idea to embed an image into html as
But what do you think of adding a button to download images from remote URLs to local storage e. g. to
|
Hello, I agree that base64-encode images is not a good idea, but the content needs to be accessible from all the devices which run my application, so I cannot use a local path. Downloading images from remote URLs could be useful, it would allow to display the full HTML content even if the user is offline. |
Just released version 1.2.0. This now adds the possibility to add images from phone storage. Also an option to download remote images to phone storage has now been implemented. Some points I don't understand about synchronizing your users data:
Do you think this issue now can be closed? |
The HTML is stored in a database.
I don't quite understand. Doesn't it need each single user to download all the images to its phone local storage? |
That's true, in this case embedding into HTML makes image handling way easier. For my knowledge and document management app DeepThought I had a similar issue.
So you would know which images to remove from and which images to add to server. I also remember I once did an image synchronizing app with Couchbase Lite as database. First I stored images as Couchbase attachments which also use Base64.
Of course he must. |
I think I will follow your example to upload images. |
Hello,
The only way to insert an image is currently to know the link to it (at least this is the only way I found in the toolbar). Therefore the image can not be displayed anymore if it changes url, or if it is removed from the server it is stored on.
I suggest to add the possibility to choose the image from phone storage.
We can indeed set the src attribute with the content of the image as follows:
<img src="data:image/png;base64,..." />
(Note that image/png must be replaced with the actual mime type of the image.)
I implemented this in one of my app already, and it works:
This code requires the READ_EXTERNAL_STORAGE permission.
It must be improved because it sometimes throws an OutOfMemoryError.
Maybe using Bitmap.CompressFormat.JPEG and a quality lower than 100 could solve the problem.
The text was updated successfully, but these errors were encountered: