Here are my own function
public static string UploadImage(string imageLink, string imageSize)
{
string Link = "";
string command = "";
Post_Get login1 = new Post_Get("http://www.pimpandhost.com/upload/postUrl?req=%7B%22hash%22%3A%227582909469429%22%2C %22vall%22%3A%22" + imageLink + "%22%2C%22albumId%22%3A-1%7D");
try
{
Link = @login1.postGet();
}
catch (WebException ex)
{
return "bad";
}
StringBuilder sb = new StringBuilder(Link);
sb.Replace("\\/", "/");
Link = sb.ToString();
string pattern = @"http://www.pimpandhost.[a-z|/]+([0-9|a-z]+)";
Match Match = Regex.Match(Link, pattern);
Link = Match.Groups[1].ToString();
command = "http://www.pimpandhost.com/image/" + Link + "-original.html";
try
{
login1 = new Post_Get(command);
Link = @login1.postGet();
}
catch(WebException ex)
{
return "bad";
}
switch (imageSize)
{
case "original": pattern = "<input.+bb_codes_original.+
.*"; break;
case "thumb": pattern = "<input.+bb_codes_thumb.+
.*"; break;
case "small": pattern = "<input.+bb_codes_small.+
.*"; break;
case "medium": pattern = "<input.+bb_codes_medium.+
.*"; break;
}
Match = Regex.Match(Link, pattern);
Link = Match.ToString();
if (imageSize == "small" || imageSize == "thumb")
{
pattern = "http://.*jpg";
Match = Regex.Match(Link, pattern);
if (Match.ToString() == "")
{
pattern = "http://.*png";
Match = Regex.Match(Link, pattern);
}
Link = Match.ToString();
return "";
}
else
{
pattern = "http://i.*jpg";
Match = Regex.Match(Link, pattern);
if (Match.ToString() == "")
{
pattern = "http://i.*png";
Match = Regex.Match(Link, pattern);
}
Link = Match.ToString();
return "[IMG]" + Link + "[/IMG]";
}
}
Post_GEt is just modified get request
But this is Remote upload by the link.