Home >Backend Development >PHP Tutorial >AS3+PNGEncoder PHP 下传图片

AS3+PNGEncoder PHP 下传图片

WBOY
WBOYOriginal
2016-06-13 10:31:44911browse

AS3+PNGEncoder PHP 上传图片

AS3+PNGEncoder PHP 上传图片
2010年11月01日
  import com.adobe.images.JPGEncoder;
  import flash.display.BitmapData;
  import flash.display.Sprite;
  import flash.net.URLLoader;
  import flash.net.URLRequest;
  import flash.net.URLRequestHeader;
  import flash.net.navigateToURL;
  import flash.utils.ByteArray;
  //画位图数据
  var jpgSource:BitmapData = new BitmapData (picture.width, picture.height);
  jpgSource.draw(picture);
  //生成编码容器
  var jpgEncoder:JPGEncoder = new JPGEncoder(95);
  //将位图数据编码到容器内成为ByteArray流
  var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
  //压缩ByteArray流 这一步测试 如果去掉 不能生成 图片
  jpgStream.compress();
  //添加stream的header请求
  var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
  var jpgURLRequest:URLRequest = new URLRequest("save.php");
  jpgURLRequest.requestHeaders.push(header);
  jpgURLRequest.method = "POST";
  jpgURLRequest.data = jpgStream;
  //推送图片数据到服务器端
  navigateToURL(jpgURLRequest, "_blank");
  //用urlLoader的情况,需要指明Data数据是一个包含原始二进制数据的 ByteArray 对象
  //loader.dataFormat = URLLoaderDataFormat.BINARY;
  服务器端:
  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn