Skip to content

Instantly share code, notes, and snippets.

@beisong7
Last active June 5, 2020 10:49
Show Gist options
  • Save beisong7/825ff3156d4800ef801eedb258754bb2 to your computer and use it in GitHub Desktop.
Save beisong7/825ff3156d4800ef801eedb258754bb2 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Windows.Forms;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
/// <summary>
/// Summary description for Class1
/// </summary>
public class ImageConverter
{
public ImageConverter()
{
//
// TODO: Add constructor logic here
//
}
public string saveToFile(System.Data.Linq.Binary binary, String filename)
{
byte[] b = binary.ToArray();
MemoryStream ms = new MemoryStream(b);
return this.storeImage(ms, filename);
}
public string storeImage(MemoryStream ms, String filename)
{
string storeFolder = AppDomain.CurrentDomain.BaseDirectory;
string img_url = storeFolder + "\\images\\temp\\" + filename + ".Jpeg";
return "images/temp/" + filename + ".Jpeg";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment