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

Api call happening on using registerCallback images #337

Open
yogiis98 opened this issue Apr 27, 2023 · 8 comments
Open

Api call happening on using registerCallback images #337

yogiis98 opened this issue Apr 27, 2023 · 8 comments

Comments

@yogiis98
Copy link

Why api call is happening to https://api.tools.unlayer.com/v1/image?url=customImageUrl
when using custom image library.

Is there any way to disable this call happening to unlayer server.

@yogiis98
Copy link
Author

We use it this editor for private mailers and don't want anything to go to any external service, currently unlayer editor is making call for images.

@yogiis98
Copy link
Author

yogiis98 commented May 18, 2023

@adeelraza @lucasbesen @umairsiddique Is there any way we can disable these proxy calls happening because right now we are using custom image chooser where we are passing the image url back to done callback on registerCallback('images')

Currently it is looking like things are unnecessarily making api call when they are not being used as well. or Is it a bug. Please help.

@Shashankd48
Copy link

Shashankd48 commented Jul 17, 2023

I'm looking for the same issue Is there any way we can upload images to our domain and giver URL here?

@SebastianLindback
Copy link

selectImage callback will place you in direct control of the image uploading and management.
https://docs.unlayer.com/docs/custom-image-library

unlayer.registerCallback('selectImage', function (data, done) {
// Open your image library
// Once a user picks an image, call the done function with URL
done({ url: "IMAGE URL GOES HERE" });
});

@SebastianLindback
Copy link

to use your own storage you can use the "image" callback.

const onReady = async () => {

emailEditorRef?.current?.registerCallback(
  "image",
  async function (file, done) {
    var dataa = new FormData();
    dataa.append("file", file.attachments[0]);
    done({ progress: 0 });

    axios
      .post(`/files/v1`, dataa, {
        headers: {
          "Content-Type": "multipart/form-data",
        },
      })
      .then(({ data }) => done({ progress: 100, url: data?.url }));
  }
);

.....

<EmailEditor
ref={emailEditorRef}
onReady={() => onReady()} />

@greedysiru
Copy link

even when using the image callback for custom image handling, I observe that a request is still made to:

https://api.tools.unlayer.com/v1/image?url=...

@adeelraza
Copy link
Contributor

adeelraza commented Oct 29, 2024

This call happens when you try to edit the image. This is because the image editor in browser does not allow CORS URLs so Unlayer has to proxy the image from our servers.

Do you want to disable the image editor in the builder?

@prabinKshrestha
Copy link

Are you still getting the issue @greedysiru ? I am getting this issue. It was working fine, but now I noticed that the request is being made to unlayer.

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

6 participants