2014-12-04 1 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.

Смежные вопросы