weixin_33726318 2014-06-09 16:04 采纳率: 0%
浏览 7

Ajax发布图像颜色数据

I have a large array of 76800 color values (320px x 240px image). I have tried posting a single array of these values, but it just seems to be far too big. Is there any way to format this array as to shrink the size and post it in a simple format so I can extract the data?

The array is multidimensional with each entry looking like:

["14140603","14337981","13879745","13748159","13812668","13944509"...
  • 写回答

1条回答 默认 最新

  • weixin_33747129 2014-06-09 16:16
    关注

    Best method i can think of without refactoring a load of your application code would be to see if compressing the array helps.

    http://pieroxy.net/blog/pages/lz-string/index.html

    That library implements LZW compression in javascript. You will ofcourse need to turn your multi-dimension array to a string first. Probably the best way is to turn the array to a JSON string, then compress it. Most languages will have a JSON library and a plethora of compression libraries. So you shouldn't have any difficulty, decompressing an reinflating the array back for processing server side.

    There's other methods you could take, including reconfiguring your server (which could open you up to vulnerabilities), or you could implement a custom chunked upload approach. But if the compression method works, it will be the quickest to implement and the most robust.

    评论

报告相同问题?