0

我正在使用 Aviary API 进行在线照片编辑器。直到现在我开始工作以保存文件,但我无法让它以高分辨率保存文件。PS 我联系了 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>
4

1 回答 1

0

您缺少在 onSaveButtonClicked 中调用的 onSaveHiRes 函数。

于 2015-05-06T04:24:47.503 回答