[js] Convert image to base64