1

I will send image file only to API. So I want to convert blob URL to image file for send file image to API and Image resize in ionic 5. Image resize = width 1920 height 1500

var myHeaders = new Headers();
  myHeaders.append("Content-Type", "application/octet-stream");
  myHeaders.append("Ocp-Apim-Subscription-Key", "34eaa66962334324b96a154beb56b44d");
  myHeaders.append("Host", "southeastasia.api.cognitive.microsoft.com");        
  var file = imageUrl;
  var requestOptions : RequestInit = {
    method: 'POST',
    headers: myHeaders,          
    body: file,
    redirect: 'follow'
  };
  console.log(requestOptions)
  fetch(url, requestOptions).then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

result : blob:http://localhost:8100/2a516850-518e-4f28-b8b8-f1edd3e34f73

Pirstscart
  • 11
  • 2

0 Answers0