鸟舍 WEB API 保存高分辨率问题

Aviary WEB API Save High resolution issue

本文关键字:高分辨率 问题 保存 API WEB 鸟舍      更新时间:2023-09-26

我正在使用Aviary API在线照片编辑器。到目前为止,我开始保存文件,但我无法让它以高分辨率保存文件。附言:我联系了鸟舍,他们对我的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>

您缺少 onSaveHiRes 函数,您在 OnSaveButtonClicked 中调用该函数。