Aviary WEB API保存高分辨率问题

时间:2014-12-04 03:05:45

标签: javascript html html5 api aviary

我在线使用Aviary API进行照片编辑。到目前为止,我已经开始努力保存文件,但我无法让它以高分辨率保存文件。 附:我联系了Aviary,他们对我的API进行了一些更改。

这是我的代码:

   <!DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8">
      <title></title>
      <!-- Load Feather code -->
      <script type="text/javascript" src="http://feather.aviary.com/js/feather.js"></script>
      <script src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/md5.js"></script>

      <!-- Instantiate Feather -->
      <script type='text/javascript'>
       var tool = ['enhance', 'effects', 'frames', 'orientation', 'focus', 'resize', 'crop', 'warmth', 'brightness', 'contrast', 'saturation', 'sharpness', 'colorsplash', 'draw', 'text', 'redeye', 'whiten', 'blemish'];

       var ts = Math.round((new Date()).getTime() / 1000);

       var hash = CryptoJS.MD5("MY API", "API SECRET", ts, guid());

       function guid() {
        function _p8(s) {
          var p = (Math.random().toString(16)+"000000000").substr(2,8);
          return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ;
        }
        return _p8() + _p8(true) + _p8(true) + _p8();
      }

      var featherEditor = new Aviary.Feather({
       apiKey: 'MY API',
       apiVersion: 3,
           theme: 'dark', // Check out our new 'light' and 'dark' themes!
           tools: tool,
           appendTo: 'injection_site',
           language: 'en',

           timestamp: ts,
           salt: guid(),
           encryptionMethod: 'md5',
           signature: hash,
           hiresUrl: 'http://i.imgur.com/KTH5RwX.jpg',

           onSaveButtonClicked: function(imageID, newURL) {
             var img = document.getElementById(imageID);
             img.src = newURL;
             featherEditor.saveHiRes();
             return false;

           },
           onError: function(code, msg) {
            alert(code);
          }
        });

      function launchEditor(id, src) {
       featherEditor.launch({
         image: id,
         url: src,
       });
       return false;
     }
   </script>
 </head>
 <body>
  <div id='injection_site'></div>

  <img id='image1' src='http://i.imgur.com/KTH5RwX.jpg'/ width="600" height="800">

  <!-- Add an edit button, passing the HTML id of the image and the public URL of the image -->
  <p><input type='image' src='http://images.aviary.com/images/edit-photo.png' value='Edit photo' onclick="return launchEditor('image1', 'http://i.imgur.com/KTH5RwX.jpg');" /></p>

</body>
</html>

1 个答案:

答案 0 :(得分:0)

你缺少onSaveHiRes函数,你在onSaveButtonClicked中调用它。