weixin_33709219 2019-05-21 17:15 采纳率: 0%
浏览 39

将图片上传到编辑器

I have this piece of code that reads in an image when a image linked is copied in and enter is hit , i want to change this so that i am able to upload an image instead of copying a link of one, any help would be great. I want to be able to simply add some other src function to call the uploaded file in instead of the pasted link one I hope that i can get some help on this i know it may be simple but I cant think index.html contains

function addImage(e) {
  var imgUrl = $("#imgUrl").val();

  if (imgUrl.length) {

    $("#imageContainer img").attr("src", imgUrl);
  }
  e.preventDefault();
}

$("#urlBox").submit(addImage);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id="urlBox" class="center">
  <input class="url-box" type="url" id="imgUrl" placeholder="Paste any image link and hit enter to start playing.">
</form>

<!--Controls for CSS filters via range input-->
<div class="sliders">
  <form id="imageEditor">
    <p>
      <label for="gs">Grayscale</label>
      <input id="gs" name="gs" type="range" min=0 max=100 value=0>
    </p>

    <p>
      <label for="blur">Blur</label>
      <input id="blur" name="blur" type="range" min=0 max=10 value=0>
    </p>

    <p>
      <label for="br">Brightness</label>
      <input id="br" name="br" type="range" min=0 max=200 value=100>
    </p>

    <p>
      <label for="ct">Contrast</label>
      <input id="ct" name="ct" type="range" min=0 max=200 value=100>
    </p>

    <p>
      <label for="huer">Hue Rotate</label>
      <input id="huer" name="huer" type="range" min=0 max=360 value=0>
    </p>

    <p>
      <label for="opacity">Opacity</label>
      <input id="opacity" name="opacity" type="range" min=0 max=100 value=100>
    </p>

    <p>
      <label for="invert">Invert</label>
      <input id="invert" name="invert" type="range" min=0 max=100 value=0>
    </p>

    <p>
      <label for="saturate">Saturate</label>
      <input id="saturate" name="saturate" type="range" min=0 max=500 value=100>
    </p>

    <p>
      <label for="sepia">Sepia</label>
      <input id="sepia" name="sepia" type="range" min=0 max=100 value=0>
    </p>

    <input type="reset" form="imageEditor" id="reset" value="Reset" />
  </form>
</div>

</div>
  • 写回答

0条回答 默认 最新

      报告相同问题?

      悬赏问题

      • ¥15 Java中import为灰色
      • ¥15 手机等其他智能设备被监听
      • ¥15 在win10 64位的vs打包MSI文件,放到win7 64位上安装成可执行exe文件后,点击程序不运行。
      • ¥50 大众点评用户浏览/消费记录爬虫
      • ¥15 求制作一个个人网页,
      • ¥15 寻涂色内存脚本作者有项目有市场有资源.却技术
      • ¥15 蓝桥杯c51单片机问题
      • ¥15 ajax跨域问题请求修改代码
      • ¥15 python matplotlib
      • ¥15 短信测压+语音,有偿,必须用Python