2014-12-04 92 views
0

我在線使用Aviary API進行照片編輯。直到現在,我開始努力保存文件,但我無法使其工作以高分辨率保存文件。 P.S.我聯繫了Aviary,他們對API進行了一些更改。Aviary WEB 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> 

回答

0

你缺少onSaveHiRes功能,您在onSaveButtonClicked調用。