Javascript裁剪图像客户端 [英] Javascript crop image client-side

查看:134
本文介绍了Javascript裁剪图像客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在上传到服务器之前使用javascript或jQuery在客户端裁剪和压缩图像。

I'd like to use javascript or jQuery to crop and compress an image on the client side before uploading to the server.

WorkFlow:


  1. 选择图像

  2. 裁剪图像为特定尺寸

  3. 压缩裁剪

  4. 上传

  1. Select Image
  2. Crop Image to specific size
  3. Compress the crop
  4. Upload

以前有人这样做过吗?什么插件或我该怎么做?

Has anyone done this before? What plugin or what do I have to do?

我看到facebook可以压缩图像并在上传前自动调整大小。

I see facebook can do compressing images and automatically resizing them before uploading.

推荐答案


编辑(2014):此答案现已过时! JavaScript是一种编程语言,其实现受到浏览器资源可用的深度影响
。在这篇文章发表时(2011年7月),三年前的b $ b b浏览器没有任何
类可靠的功能,这将允许OP做他们要求的b $ b,因此我的回答。 / em>

如果你现在仍然对如何做到这一点感兴趣,请参考这个问题的许多答案,这些答案在SO的同时出现了
。但请不要再对这个答案进行任何
的进一步评论,因为它显然毫无意义。谢谢。

EDIT (2014): This answer is now obsolete! JavaScript is a programming language with implementations that are deeply influenced by what browser resources are being made available to them. Three years ago when this post was made (July 2011) browsers didn't have any kind of reliable functionality which would allow OP to do what he asked for, hence my answer.
If you are still interested in how this can be done now please consult some of the many answers to this question which have appeared in the meantime on SO. But please restrain yourself from making any further comments to this answer because its obviously pointless. Thank you.

简单地说,JavaScript并不意味着要做你想要的。无论您遇到哪种服务都可以操作选定的图像,您可以在提供任何其他功能之前将图像完全上传到服务器上。

Simply put JavaScript is not meant to do what you are asking for. Whatever service you encounter that offers the ability to manipulate selected images you can bet your money that the image has been uploaded completely to the server before any other functionality was offered.

这篇关于Javascript裁剪图像客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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