Skip to main content

Get Base64 String From Image In C#

Below is the code to convert an image into the base64 string in C#. Syntax static void Main(string[] args) { string imagePath=@”E:\images\sample.png”; string imgBase64String = GetBase64StringForImage(imagePath); Console.WriteLine(imgBase64String); } protected static string GetBase64StringForImage(string imgPath) { byte[] imageBytes = System.IO.File.ReadAllBytes(imgPath); string base64String = Convert.ToBase64String(imageBytes); return base64String; }   Example  

Read More

Loading Image For Every HTTP Service Call In AngularJS

Whenever we use an HTTP call in AngularJS, we want to show the loading image by default. So here, we are going to see the process with a sample example. Below is the complete code for the index.html, script.js, and studentData.json page. Complete code for HTML <!DOCTYPE html> <html> <head> <script src=”http://code.jquery.com/jquery-1.9.1.min.js”></script> <script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js”></script> <script […]

Read More