If you want to use different headers for image, I would suggest you to use fetch
api to download the image with customer headers like:
fetch("https://i.picsum.photos/id/525/200/300.jpg?hmac=Dhg6JV7Cl1oDtYMG0pq3hVUbGQjEpOX41178aR7_eh8", {
headers: {
"Some": "header",
}
})
.then(resp => resp.blob())
.then(blobData => {
console.log(blobData)
const reader = new FileReader();
reader.readAsDataURL(data);
reader.onloadend = function () {
const base64data = reader.result;
// this is the data you can use in src attribute of img
console.log(base64data);
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…