• <bdo id='hoXa1'></bdo><ul id='hoXa1'></ul>

    <small id='hoXa1'></small><noframes id='hoXa1'>

    1. <legend id='hoXa1'><style id='hoXa1'><dir id='hoXa1'><q id='hoXa1'></q></dir></style></legend>
      <i id='hoXa1'><tr id='hoXa1'><dt id='hoXa1'><q id='hoXa1'><span id='hoXa1'><b id='hoXa1'><form id='hoXa1'><ins id='hoXa1'></ins><ul id='hoXa1'></ul><sub id='hoXa1'></sub></form><legend id='hoXa1'></legend><bdo id='hoXa1'><pre id='hoXa1'><center id='hoXa1'></center></pre></bdo></b><th id='hoXa1'></th></span></q></dt></tr></i><div id='hoXa1'><tfoot id='hoXa1'></tfoot><dl id='hoXa1'><fieldset id='hoXa1'></fieldset></dl></div>
        <tfoot id='hoXa1'></tfoot>

      1. 如何将图像上传到 HTML5 画布中

        How to upload image into HTML5 canvas(如何将图像上传到 HTML5 画布中)

            <small id='0p35n'></small><noframes id='0p35n'>

            <tfoot id='0p35n'></tfoot>

              <legend id='0p35n'><style id='0p35n'><dir id='0p35n'><q id='0p35n'></q></dir></style></legend>
            1. <i id='0p35n'><tr id='0p35n'><dt id='0p35n'><q id='0p35n'><span id='0p35n'><b id='0p35n'><form id='0p35n'><ins id='0p35n'></ins><ul id='0p35n'></ul><sub id='0p35n'></sub></form><legend id='0p35n'></legend><bdo id='0p35n'><pre id='0p35n'><center id='0p35n'></center></pre></bdo></b><th id='0p35n'></th></span></q></dt></tr></i><div id='0p35n'><tfoot id='0p35n'></tfoot><dl id='0p35n'><fieldset id='0p35n'></fieldset></dl></div>

                  <tbody id='0p35n'></tbody>

                • <bdo id='0p35n'></bdo><ul id='0p35n'></ul>

                  本文介绍了如何将图像上传到 HTML5 画布中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我目前正在使用 http://paperjs.org 创建一个 HTML5 画布绘图应用程序.我想让用户将图像上传到画布中.我知道我需要登录和注册,但有更简单的方法吗?我看过 HTML5 拖放上传.

                  I am currently using http://paperjs.org to create an HTML5 canvas drawing app. I want to let users upload images into the canvas. I know I need to make a login and signup but is there an easier way? I have seen the HTML5 drag and drop upload.

                  推荐答案

                  我假设你的意思是,将图像加载到画布中,而不是从画布上传图像.

                  I assume you mean, to load an image into the canvas and not uploading the image from the canvas.

                  阅读他们在这里的所有画布文章可能是个好主意https://developer.mozilla.org/en-US/docs/Web/指南/HTML/Canvas_tutorial/Using_images

                  It'd probably be a good idea to read through all the canvas articles they have over here https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Canvas_tutorial/Using_images

                  但基本上你想要做的是在 javascript 中创建一个图像,并将 image.src = 设置为文件位置.在从用户端加载图像的情况下,您将需要使用文件系统 API.

                  But basically what you want to do is create an image in javascript, and set the image.src = to whatever the file location is. In the case of loading images from the user on their end, you're going to want to use the File System API.

                  这里放一个简单的例子:http://jsfiddle.net/influenztial/qy7h5/

                  Threw together a brief example here: http://jsfiddle.net/influenztial/qy7h5/

                  function handleImage(e){
                      var reader = new FileReader();
                      reader.onload = function(event){
                          var img = new Image();
                          img.onload = function(){
                              canvas.width = img.width;
                              canvas.height = img.height;
                              ctx.drawImage(img,0,0);
                          }
                          img.src = event.target.result;
                      }
                      reader.readAsDataURL(e.target.files[0]);     
                  }
                  

                  这篇关于如何将图像上传到 HTML5 画布中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to make rooftext effect and valley text effect in HTML5 (or Fabric.js)(如何在 HTML5(或 Fabric.js)中制作屋顶文字效果和山谷文字效果)
                  Draw border around nontransparent part of image on canvas(在画布上的图像不透明部分周围绘制边框)
                  dragging and resizing an image on html5 canvas(在 html5 画布上拖动图像并调整其大小)
                  What#39;s the difference between a boolean as primitive and a boolean as property of an object?(作为原始对象的布尔值和作为对象属性的布尔值有什么区别?)
                  I want to do animation of an object along a particular path(我想沿特定路径对对象进行动画处理)
                  How to show a running progress bar while page is loading(如何在页面加载时显示正在运行的进度条)
                      <bdo id='AHdFz'></bdo><ul id='AHdFz'></ul>
                      1. <tfoot id='AHdFz'></tfoot>

                        <small id='AHdFz'></small><noframes id='AHdFz'>

                        • <i id='AHdFz'><tr id='AHdFz'><dt id='AHdFz'><q id='AHdFz'><span id='AHdFz'><b id='AHdFz'><form id='AHdFz'><ins id='AHdFz'></ins><ul id='AHdFz'></ul><sub id='AHdFz'></sub></form><legend id='AHdFz'></legend><bdo id='AHdFz'><pre id='AHdFz'><center id='AHdFz'></center></pre></bdo></b><th id='AHdFz'></th></span></q></dt></tr></i><div id='AHdFz'><tfoot id='AHdFz'></tfoot><dl id='AHdFz'><fieldset id='AHdFz'></fieldset></dl></div>

                          <legend id='AHdFz'><style id='AHdFz'><dir id='AHdFz'><q id='AHdFz'></q></dir></style></legend>
                            <tbody id='AHdFz'></tbody>