Hello guys,
Im trying to send reports through e-mail service. But since the email's body uses HTML, to insert an image, you need to assin that paragraph the right url.
If so, I'm trying to implement the imgur API to retrieve the upload link and use it on the string, like this:
<img= "">
To upload the image I managed to find this code that outputs the values necessary. But how can I retrieve the imgur ?.
This code actually uses a default image, how can i change it to convert the image from a picturebox?
What I have tried:
The code I have to simply upload a default image to imgur. Without retrieving the link string needed to be used in the 1st question.
using (var w = new WebClient())
{
using (var ms = new MemoryStream())
{
var values = new NameValueCollection
{
{ "key", "2781d465a48c3e2" },
{ "image", Convert.ToBase64String(File.ReadAllBytes(@"Default.jpg")) }
};
byte[] response = w.UploadValues("http://imgur.com/api/upload.xml", values);
Console.WriteLine(XDocument.Load(new MemoryStream(response)));
}
}
This gives me this output:
<data type="array" success="1" status="200">
<id>T2O8lwI</id>
<title />
<description />
<datetime>1496402171</datetime>
<type>image/jpeg</type>
<animated>false</animated>
<width>600</width>
<height>800</height>
<size>53452</size>
<views>0</views>
<bandwidth>0</bandwidth>
<vote />
<favorite>false</favorite>
<nsfw />
<section />
<account_url />
<account_id>0</account_id>
<is_ad>false</is_ad>
<in_most_viral>false</in_most_viral>
<tags />
<ad_type>0</ad_type>
<ad_url />
<in_gallery>false</in_gallery>
<deletehash>CKmIUBffASpWHTW</deletehash>
<name />
<link>http:
</data>