none
Convert Image To Base64 inline using web browser control in c# win forms. RRS feed

  • Question

  • Hello All,
    I have a web browser control in c# win form and I am loading image using webBrowser.Document.ExecCommand("InsertImage",true",null); code, and I want to convert image base64 and save base64 string in to database without file path.
    So, Please Help me.
    Saturday, August 20, 2016 12:06 PM

Answers

  • Hello,

     Try reading the information at the following link;

    https://msdn.microsoft.com/en-us/library/dhx0d524(v=vs.110).aspx

     There also includes some examples to help you understand the conversion of data.

     Hope this helps :)

    • Marked as answer by H J SOFT Monday, August 22, 2016 4:43 AM
    Sunday, August 21, 2016 12:12 PM
  • There are two basic approaches on how to store blobs with a database, as well as a combination form:
    An Introduction to SQL Server FileStream

    Storing the image as a base64 encoded string in the DB is extremely odd. There is usually no sense to convert it to a format that needs more space during storage. I have to question the validity of that whole process you came up with. You should propably go a few steps back and tell us what problem you tried to solve.

    base64 encoding is only needed when transmitting the image over the internet - mail, xml or inline images.
    Note that while inline images exist, they are a bit frowned upon. They bloat the size of the html and are a bit harder by virus scanners to scan for the usual image related viruses. They are bit like Frames in that regard - there, but not a good tone to use them.

    If you plan on sending those images per HTML mail to get around Mail clients not showing images from a server, forget it. Outlook is known to just treat inline images as attachments. You are not the first one that has tried that.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    • Marked as answer by H J SOFT Monday, August 22, 2016 4:43 AM
    Sunday, August 21, 2016 12:48 PM

All replies

  • Hello,

    For C# questions post in that forum.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, August 20, 2016 12:59 PM
    Moderator
  • Hello,

     Try reading the information at the following link;

    https://msdn.microsoft.com/en-us/library/dhx0d524(v=vs.110).aspx

     There also includes some examples to help you understand the conversion of data.

     Hope this helps :)

    • Marked as answer by H J SOFT Monday, August 22, 2016 4:43 AM
    Sunday, August 21, 2016 12:12 PM
  • There are two basic approaches on how to store blobs with a database, as well as a combination form:
    An Introduction to SQL Server FileStream

    Storing the image as a base64 encoded string in the DB is extremely odd. There is usually no sense to convert it to a format that needs more space during storage. I have to question the validity of that whole process you came up with. You should propably go a few steps back and tell us what problem you tried to solve.

    base64 encoding is only needed when transmitting the image over the internet - mail, xml or inline images.
    Note that while inline images exist, they are a bit frowned upon. They bloat the size of the html and are a bit harder by virus scanners to scan for the usual image related viruses. They are bit like Frames in that regard - there, but not a good tone to use them.

    If you plan on sending those images per HTML mail to get around Mail clients not showing images from a server, forget it. Outlook is known to just treat inline images as attachments. You are not the first one that has tried that.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    • Marked as answer by H J SOFT Monday, August 22, 2016 4:43 AM
    Sunday, August 21, 2016 12:48 PM
  • The above ExecCommand seems to display a dialog box for image data. Is your question about the conversion, or about determining the details of just inserted image?

    Sunday, August 21, 2016 4:58 PM
  • Hi Viorel,

    Thanks

    Yes, you are right ExecCommand get information about image. but after that I want to that particular image convert to base64 string without it's path or file location information.

    Monday, August 22, 2016 4:45 AM