我正在尝试在我的 ruby on rails 站点中使用 Aviary API。我无法取回 Aviary 在 onSave 函数中创建的 URL。我不知道如何在 ruby 中访问它。你有想法吗?我想在 ruby 中使用的变量是newURL
<% if @photo.image? %>
<!-- Load widget code -->
<script language="JavaScript" type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/js/feather.js"></script>
<!-- Instantiate the widget -->
<script type="text/javascript">
var featherEditor = new Aviary.Feather({
apiKey: ' f20374413e3ff5a8',
apiVersion: 2,
theme: 'light',
tools: 'all',
appendTo: '',
fileFormat: 'jpg',
onSave: function(imageID, newURL) {
var img = document.getElementById(imageID);
img.src = newURL;
},
});
function launchEditor(id, src) {
featherEditor.launch({
image: id,
url: src
});
return false;
}
</script>
<!-- Add an edit button, passing the HTML id of the image and the public URL to the image -->
<a href="#" data-refresh="true" onclick="return launchEditor('editimage1',
'<%= @photo.image.url %>');">Edit!</a>
<img id='editimage1' src='<%= @photo.image.url %>' height="352" width="470"/>
<% end %>