0

I have a protected image URL that points to a jpeg in amazon s3 and that URL works only on our website. now I need to convert that protected URL to a public image URL. so I have converted that URL to base64 and I have got the base64 output with data:application/xml and it wasn't working when I tested that base64 with <img> tag even though I have changed data:image/jpeg. so I need a way to convert that protected URL or base64 to a public image URL. any help is very much appreciated.

I have tried this https://stackoverflow.com/questions/41778434/javascript-convert-an-url-to-a-base64-image

protected URL:

https://dqedge1.s3-ap-south-1.amazonaws.com/uploads/answers/5f47bc0094c80bcd110ad26a/5ec553ceb74af11047f00062/answer/1630903224748.jpeg

base64: data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPEVycm9yPjxDb2RlPkFjY2Vzc0RlbmllZDwvQ29kZT48TWVzc2FnZT5BY2Nlc3MgRGVuaWVkPC9NZXNzYWdlPjxSZXF1ZXN0SWQ+WjdBTTAwUjU0VzY1MkNOQzwvUmVxdWVzdElkPjxIb3N0SWQ+Q05GV1ZkNHV3amY5NGZaajlMNHpEMi85R2ovdUwyUW9nM0hEUEhzOWlDOUhtclpQTGNpaUdXenY4ajRNSkNqU29NZ0ZNbTdRVUQwPTwvSG9zdElkPjwvRXJyb3I+

demo

Prem Kumar
  • 57
  • 7
  • Your base64 is an xml. You have to get the image data first then convert it to base64. Try requesting the url with Referer and Host parameter in HEADERS – dreygur Sep 06 '21 at 07:06
  • [https://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript](https://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript) – Sadegh Sep 06 '21 at 07:37

0 Answers0