Skip to content

Use Firebase Image Object in merge #116

Open
@ctsYvesHuber

Description

@ctsYvesHuber

Hello guys,
I am currently working on a project where I need to merge 2 images that are stored in the firebase storage.
I can fetch the images but when I try to merge them I get the following error:

Uncaught (in promise) DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
    at http://localhost:3000/static/js/bundle.js:64075:21
            { src: firebaseImage.src }, 
            { src: firebaseSignature.src, x: xPosition, y: yPosition }
        ]).then(b64 => {
            document.getElementById('generated').src = b64;
        });

I am using React in the front end and Firebase as my backend.
here the code for fetching the Image:

        getDownloadURL(ref(storage, url)).then((url) => {
            const xhr = new XMLHttpRequest();
            xhr.responseType = 'blob';
            xhr.onload = (event) => {
                const blob = xhr.response;
            };
            xhr.open('GET', url);
            xhr.send();
            // Or inserted into an <img> element
            const img = document.getElementById(id);
            setImage(img)
            img.setAttribute('src', url);
        }).catch((error) => { // Handle any errors
        });
    }

And the output of my Image variable:
<img id="preview" width="300" height="400" src="<Imagesrc>">
The src is correct I just didn't want to use the real src

Thank you for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions