douchuose2514 2016-04-19 22:03
浏览 177


I am using an image editing tool for users to upload their images and adjust:

I am able to shorten the base64 string by sending it through a couple functions. I am then trying to insert this into a hidden field and submit the form.

$('#submit-update-business').on('click', function(e){
    // console.log(vanilla.get());
    vanilla.result('canvas', 'viewport', 'png', 0).then(function(src){
        var processed = Base64.encode(JSON.stringify(src));

I know the string is long, but I can't figure out any other way to do this. I've also seen answers that suggest submitting the form through ajax, but this seems to have the same pitfalls. This actually manages to work ok on desktop browsers. It's the mobile ones that have a problem. I can limit the dimensions of the image to less than 3000x3000, but unfortunately phones seem to be taking much higher quality photos.

The tool I'm using, Croppie, has a way to get the data points and zoom, but not the orientation. If there is a way to save this data, or use the base64 data, and re-render the image, and somehow use that image so the image actually goes through, that would be great. If there is a solution I can use just for mobile, that would work too, since it works just fine on desktop.

  • 写回答

1条回答 默认 最新

  • dpcwz210393 2016-04-20 10:28

    With ajax post instead of submit you don't need a hidden_field if it has length limits in mobile browser. Base64 encoding overhead is not necessary too if you don't need it on a server side.

        new_image: processed, // or new_image: src,
        other_form_param_or_data: 'some_data'
    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥20 来一个会抓包app支付接口的
  • ¥30 vivado2017.4的sdk打不开
  • ¥50 matlab,文献复现
  • ¥20 寻找Flink CDC指导,有偿咨询
  • ¥15 cruise如何仿真不同温度下车辆的经济性?
  • ¥20 扑克牌游戏的完整代码
  • ¥88 求帮安装Python架构的vnpy
  • ¥20 逻辑回归法分析品牌知名度和购买意向
  • ¥15 华为云主机-异常连接
  • ¥50 vue 成绩列表 输入成绩,并统计各分数段人数