GithubHelp home page GithubHelp logo

wzxicy2221 / localresizeimg3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hho2002/localresizeimg3

0.0 1.0 0.0 1.45 MB

前端本地客户端压缩图片,兼容IOS,Android,PC。

Home Page: http://lrz3.herokuapp.com

JavaScript 96.06% HTML 3.94%

localresizeimg3's Introduction

介绍一下

  • 基于原生js
  • 提供pc & mobile版本,修复之前各位提到的BUG和疑问。
  • 仔细思考后,再一次重构了代码,移除了UI,仅作为纯粹的工具,方便二次开发。

希望这一版本能够真正帮到大家。 :)

演示

在线演示

基本例子

请先根据情况引入 lrz.mobile.min.jslrz.pc.min.js

var input = document.querySelector('input');

input.onchange = function () {
    // 也可以传入图片路径:lrz('../demo.jpg', ...
	lrz(this.files[0], function (results) {
	  // 你需要的数据都在这里,可以以字符串的形式传送base64给服务端转存为图片。
      console.log(results); 
	});
}

详细API,点我

兼容性

  • IE9 及 以上
  • chrome 什么的都支持。
  • 移动设备几乎都支持(IOS低于IOS7.1.2除外),若有问题,请先在 在线演示 测试一下(移动设备请扫描二维码)。

移动设备请扫描

lrz的历史

  • lrz1,基于jquery。
  • lrz2,基于原生js,却是用coffeescript写的 Orz, 有UI,存在已知BUG。

常见问题

有疑问请直接在 issues 中提问👊,说明设备、型号及平台

  • Q:有时拍摄完照片后,页面自动刷新或闪退了。
  • A:内存爆掉了,常见于低配android手机,可以每次上传完毕后设置 results.base64 = null; 来释放内存,改善情况。
  • Q: 直接传入图片路径的无法生成图片
  • A: 可能有跨域的问题,具体请看CORS_enabled_image

时间: 2015年02月
演示: 在线演示
下载: 点此进入
博客: think2011

localresizeimg3's People

Contributors

think2011 avatar

Watchers

Wang Zexin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.