3

我正在使用 Aviary 照片编辑器,我希望用户无需编写 PHP 即可使用自己的照片。所以我创建了一个代码,以便用户放置图像的 url,然后他们可以在那里编辑它,代码是

$(function() {
 $('#imgsrc').hide();
  $('#edit').hide();
$('#sub_img').click(function(e) {
  e.preventDefault();
     var grant= $('#photo_url').val();
   $('#imgsrc').attr('src', grant).show();
   $('#edit').show();
 });
});

虽然我收到了这个错误

There was a problem loading your image provided by URI to the网址config key. Either you typed the address wrong, it's not reachable by the public (and our service at http://featherservices.aviary.com/), or it doesn't really exist. Or maybe YOU don't and this is all just a dream. WAKE UP!

鸟舍的代码是

<div id="photo_edit">
 <!-- Load Feather code -->
  <script type="text/javascript" src="http://feather.aviary.com/js/feather.js"></script>
 <div id='injection_site'></div>

  <input type="text" id="photo_url" placeholder="URL of Image"/>
     <button id="sub_img">Submit Image</button>

    <img id="imgsrc" src=""/>
      <!-- Instantiate Feather -->
 <script type="text/javascript">
   var featherEditor = new Aviary.Feather({
   apiKey: 'LuucZHMFU0yLQSnGBgAqsg',
   apiVersion: 2,
   tools: 'enhance,resize,crop,contrast,sharpness,text,whiten,effects,orientation,warmth,brightness,saturation,draw,redeye,blemish',
   appendTo: '',
   onSave: function(imageID, newURL) {
       var img = document.getElementById(imageID);
       img.src = newURL;
   },
   onError: function(errorObj) {
       alert(errorObj.message);
   }
   });
   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 ot the image -->
 <p><input id="edit" type='image' src='http://images.aviary.com/images/edit-photo.png' value='Edit photo' onclick="return launchEditor('imgsrc', 'onImageLoad');" /></p>
         </div>

以前有人用过这个程序吗?这只是假设是一个 hack,我不想将 PHP 用于主机映像。如果可能的话,它应该只是使用 url 充当图像编辑器吗?

4

1 回答 1

1

如果您允许用户从各种网络资源上传文件。

您可以尝试使用 Filepicker.io 插件来实现上传功能。

https://developers.filepicker.io/docs/web/

于 2013-04-22T12:22:07.610 回答