JSFiddle - React, Tailwind, and code Playground
by Himel Nag Rana
HTML
<script src="https://code.jquery.com/jquery-2.2.3.js"></script>
<div id="map_div"></div>
JavaScript
var imageUrl = "https://maps.googleapis.com/maps/api/streetview?size=600x300&location=23.7610974,90.3720526&heading=310";
convertFunction(imageUrl, function(base64Img){
var img = "<img src='"+base64Img+"'>";
$('#map_div').html(img);
});
function convertFunction (url, callback){
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function() {
var reader = new FileReader();
reader.onloadend = function () {
callback(reader.result);
}
reader.readAsDataURL(xhr.response);
};
xhr.open('GET', url);
xhr.send();
}