FluorineFx Sample (大头贴)

利用FluorineFx的remoting做的大头贴,

要注意的是,

fluorineFx里的amf3包里才有byteArray的类,你要在net里引用它,

client在传byteArray给server 之前,要用JPGEncoder转一下,其实就是加一些jpg的信息进去.这个我是用了adobe的as3corelib包,

net code:

using System;
using System.Collections.Generic;
using System.Text;
using FluorineFx;
using FluorineFx.AMF3;
using System.IO;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web; 



namespace CreatePic
{
    /// 
    /// Fluorine sample service.
    /// 
    [RemotingService("Fluorine sample service")]
    public class CreatePic
    {
        public CreatePic()
        {
        }

        public string Echo(string text)
        {
            return "Gateway echo: " + text;
        }

        public void getPic(ByteArray byteArray,string fileName)
        {
            uint length = byteArray.Length;
            byte[] bytes = new byte[length];
            byteArray.ReadBytes( bytes, 0, length);
            MemoryStream ms = new MemoryStream(bytes);

            Image img = Bitmap.FromStream(ms);
            Bitmap bmp = new Bitmap(img);

            //To save the image to a file
            MemoryStream tempStream = new MemoryStream();
            bmp.Save(tempStream,System.Drawing.Imaging.ImageFormat.Jpeg);

            FileStream fs = new FileStream(System.Web.HttpContext.Current.Server.MapPath(fileName), FileMode.Create);
            tempStream.WriteTo(fs);
            tempStream.Close();
            fs.Close();
        } 

    }
}
server code     download :    
client  code      download :

你可能感兴趣的:(image,String,server,Adobe,download,byte)