Click here to Skip to main content
15,887,331 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have created webform where question with four options get populated from database,but when options containing mathematical expression then how to create the option from database.do i need to save all the four options in image format to database or file system or any other option is available?

What I have tried:

I have created this for simple text(not for mathematical expression)
please help me
Posted
Updated 21-Sep-16 1:15am

1 solution

That's complicated - mathematical formulae can be displayed, but it needs careful work with fonts to get it right in a website - and there will always be someone who doesn't have the "right" font installed! It's not trivial to create the font sequences to display complex formulae - it you look at Wolfram Alpha they use images: https://www.wolframalpha.com/input/?i=integrate+sin+x+dx+from+x%3D0+to+pi&lk=3[^]

I'd suggest that you go with the image for these - you can store them as a Base64 string and put that directly into your webpage very easily:
C#
byte[] rawData = File.ReadAllBytes(@"D:\Test Data\BigImage.jpg");
string base64 = Convert.ToBase64String(rawData);
Response.Write(string.Format("<img src=\"data:image/jpg;base64,{0}\">", base64));
This loads an image from a file, converts it to Base64 and embeds the result as an image into the webpage.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900