Skip to content
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

How To Add Images And Videos from Gallery #247

Open
faizanShoukat55 opened this issue Sep 22, 2020 · 14 comments
Open

How To Add Images And Videos from Gallery #247

faizanShoukat55 opened this issue Sep 22, 2020 · 14 comments

Comments

@faizanShoukat55
Copy link

No description provided.

@jayantur13
Copy link

jayantur13 commented Oct 19, 2020

For Image -
To add image from phone you can make a picker which returns data string from intent,then you can do mEditor.insertImage(yourdatastring,alt,width,height)

Image from url may work, it requires internet permission maybe

Tested on Oreo 8.0

@vikas-jain-plutus
Copy link

@jayantur13 Can you please tell me the data string works or not for uploading images?

@jayantur13
Copy link

@jayantur13 Can you please tell me the data string works or not for uploading images?

Its working, you can change width, height of image too.

@vikas-jain-plutus
Copy link

@jayantur13 Actually I am sending base64 string in this method.
mEditor.insertImage(yourdatastring,alt,width,height) But selected image is not loaded in Editor view.

@jayantur13
Copy link

I think encoded string is not supported..Links like https://myimages/image.jpg (direct path) are only supported and shown in the example too.

@vikas-jain-plutus
Copy link

@jayantur13 Then How we can prepare links after selecting an image from the device?

@jayantur13
Copy link

jayantur13 commented Feb 25, 2021

@jayantur13 Then How we can prepare links after selecting an image from the device?

From the image's path file:https:///mnt/sdcard/myPicture.jpg or like from content:https://media/external/audio/media/710 Make a picker,pick an image you will get either file path or content path of image,you'll see the image in the editor

private void singleImgPicker(){
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        someActivityResultLauncher.launch(intent);

    }


    ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
            new ActivityResultContracts.StartActivityForResult(),
            new ActivityResultCallback<ActivityResult>() {
                @Override
                public void onActivityResult(ActivityResult result) {
                    if(result.getResultCode() == Activity.RESULT_OK && result.getData() != null){
                        Intent data = result.getData();
                        imglnk = data.getDataString();
                    }
                }
            });

@vikas-jain-plutus
Copy link

@jayantur13 I have used the same method as you mentioned above but the main issue is like, I need to send HTML of that image and the same image will be reflected on the web portal as well. So If I am using your way to collect data string of local image path, then it will not display on portal or web server.
Please help me on this....
Thanks in Advance...

@jayantur13
Copy link

jayantur13 commented Mar 4, 2021

Contact me on either Fb - Jayant Navrange or Instagram idevelop.around.I'll try to help you there 🙂

@vikas-jain-plutus

@vikas-jain-plutus
Copy link

vikas-jain-plutus commented Mar 4, 2021

@jayantur13 Requested on Instagram.

@vikas-jain-plutus
Copy link

@jayantur13 Can you please guide me over here? If you have no issues.

@jayantur13
Copy link

@jayantur13 Can you please guide me over here? If you have no issues.

Sure, I'm there to discuss.

@Clement-Cauet
Copy link

Hello,
I can't choose an image in my local storage, display the image in my RichEditor and stock the image in my database (I stock my html in my database) in same time.
I work with android 11 API 30.
My AndroidManifest.xml containt this lines :
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

If I use this line : instanceFragment.getRichEditor().insertImage("https://raw.githubusercontent.com/wasabeef/art/master/chip.jpg", "image", 300);
The image is display in the RichEditor and I can stock in my database but I have don't choose my image in my local storage.

If I use this line : instanceFragment.getRichEditor().insertImage("File:https://" + destination.getPath(), "image", 300);
The image isn't display in the RichEditor (the alt is display) but I can stock in my database and I have choose my image in my local storage.

If I use this line : instanceFragment.getRichEditor().insertImage(url, "image", 300);
The image is display in the RichEditor and I have choose my image in my local storage but I can't stock in my database (because this is a temp url).

This is my code :
RichEditor.txt

Can you help me please ?
Thank in advance.

@Clement-Cauet
Copy link

Hi !

I found a solution with encode base64 : #289

Bye and good luck for the future.

Clerclem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants