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 :
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值