使用JavaScript将本地图像加载到浏览器中? [英] Load local image into browser using JavaScript?

查看:127
本文介绍了使用JavaScript将本地图像加载到浏览器中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个网络到印刷,海报打印应用程序的解决方案。

I'm currently developing a solution for a web-to-print, poster printing application.

我想要包括的一个功能是能够在继续订购所述图像的海报之前,编辑(裁剪/缩放/旋转)给定图像。

One of features I'd like to include is the ability to 'edit' (crop/scale/rotate) a given image, before proceeding to order a poster of said image.

为了避免用户将图像上传到在编辑之前的远程服务器,我想知道以下内容:

To avoid the requirement of the user uploading the image to a remote server before editing, I'd like to know the following:

是否可以(使用JavaScript)将存储在客户端计算机上的图像加载到用于编辑的浏览器/浏览器内存,无需将图像上传到远程服务器?如果是这样,这是怎么做的?

谢谢,

BK

推荐答案

使用Html / Javascript,您只能使用文件上传html组件选择文件(我认为Flash / Silverlight将其包装起来以简化操作,但是仍然是沙箱)

Using Html/Javascript you can only select files using the file upload html component (I think Flash / Silverlight wrap this to make things easier but its still sandboxed)

然而,您可以使用Java Applet(或者现在称为它们),Native ActiveX控件或.Net控件来提供其他功能(这会带来安全隐患和所需的VM /运行时框架等)

You can however use Java Applets (orwhatever they are called these days), Native ActiveX controls or .Net Controls to provide additional functionality (this hase security implications and required VM/Runtimes Frameworks etc)

Adob​​e Air或其他客户端技术可能有效,但看起来您想在JavaScript中执行此操作。在这种情况下,将文件上传到服务器并从那里进行操作是最好的选择。

Adobe Air or other client side technology might work, but looks like you want to do this in JavaScript. In this case, uploading the file to the server and manipulating from there is the best bet.

*
自2010年以来,因此问题得到了解答,技术已经发展,html现在能够在浏览器中创建和操作。看到更新的答案或这些例子:
http://davidwalsh.name/resize-image-canvas
http://deepliquid.com/content/Jcrop.html
*

这篇关于使用JavaScript将本地图像加载到浏览器中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆