getBase64Image It will create base64Url from the image.The URL can be an external URL or a base64 URL. getBase64ImageFromUrl called to fetch the image from the provided URL.getImage called on the user submitting the image URL.Let’s see the code:įirst fetching the image from external URL and getting base64Data URL for the image as a string. So you can get more detail on where what is going on. I have added return types for methods, and data types for variables too. So I reordered methods and all are in a proper flow now. Previously there was issue of like async calls sequence, so some users were getting atob function error. So I searched again and finally got the code, with some custom changes. At first, I thought it had worked but the converted file was not displayed. But the issue was that it was giving data as base64 URL that can display the image by replacing src with Data: Url.Īfter trying more than 10–15 links on stack overflow, I found the solution and was able to convert the image. I integrated the package and was able to capture the image - it was displaying correctly on the page. I was using the ngx-webcam package, which allows image capture from a webcam/device camera. Created by engineers from team Browserling. There are no ads, popups or nonsense, just an awesome base64 image decoder. I’d like to share an issue I recently experienced on a project, where I needed to upload a profile pic by capturing from a camera. Just paste your base64 and it will automatically get converted to an image.
0 Comments
Leave a Reply. |