captureNewImage(interactive_area) {
        const reader = new FileReader();
        const image = new Image();
        const file_selector = interactive_area.querySelector('input[type=file]');
        const image_container = interactive_area.querySelector('.image-container');

        this.attachImageOnLoadHandler(image, image_container);

        reader.onload = event => {
            image.src = event.target.result;
            image_container.prepend(image);
        }

        file_selector.onchange = event => {
            const file = event.target.files[0];

            if (file) {
                this.state.image = file.name;
                reader.readAsDataURL(file);
                file_selector.style.display = 'none';

                const file_name_msg = document.createElement('p');
                file_name_msg.innerText = `Filename: ${file.name}`;

                image_container.appendChild(file_name_msg);
            }
        }
    }
/**
     * Handles displaying the image and other misc information immediately after the image has been selected in a file
     * selector.
     *
     * @param {HTMLDivElement} interactive_area The widget's interactive area div
     */
Handles displaying the image and other misc information immediately after the image has been selected in a file
selector.

@param {HTMLDivElement} interactive_area The widget's interactive area div
Handles displaying the image and other misc information immediately after the image has been selected in a file selector . @param { HTMLDivElement } interactive_area The widget ' s interactive area div
captureNewImage(interactive_area) {
        const reader = new FileReader();
        const image = new Image();
        const file_selector = interactive_area.querySelector('input[type=file]');
        const image_container = interactive_area.querySelector('.image-container');
        this.attachImageOnLoadHandler(image, image_container);
        reader.onload = event => {
            image.src = event.target.result;
            image_container.prepend(image);
        }
        file_selector.onchange = event => {
            const file = event.target.files[0];
            if (file) {
                this.state.image = file.name;
                reader.readAsDataURL(file);
                file_selector.style.display = 'none';
                const file_name_msg = document.createElement('p');
                file_name_msg.innerText = `Filename: ${file.name}`;
                image_container.appendChild(file_name_msg);
            }
        }
    }
captureNewImage ( interactive_area ) { const reader = new FileReader ( ) ; const image = new Image ( ) ; const file_selector = interactive_area . querySelector ( 'input[type=file]' ) ; const image_container = interactive_area . querySelector ( '.image-container' ) ; this . attachImageOnLoadHandler ( image , image_container ) ; reader . onload = event => { image . src = event . target . result ; image_container . prepend ( image ) ; } file_selector . onchange = event => { const file = event . target . files [ 0 ] ; if ( file ) { this . state . image = file . name ; reader . readAsDataURL ( file ) ; file_selector . style . display = 'none' ; const file_name_msg = document . createElement ( 'p' ) ; file_name_msg . innerText = ` ${ file . name } ` ; image_container . appendChild ( file_name_msg ) ; } } }
Handles displaying the image and other misc information immediately after the image has been selected in a file
 selector.
Handles displaying the image and other misc information immediately after the image has been selected in a file selector .