GithubHelp home page GithubHelp logo

zbage / img_compress_rotate_preview_upload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from legend-li/img_compress_rotate_preview_upload

0.0 2.0 0.0 53 KB

前端实现:图片压缩,图片旋转矫正方向,图片预览,图片二进制数据流上传

HTML 12.62% JavaScript 87.38%

img_compress_rotate_preview_upload's Introduction

前端实现:图片压缩,图片旋转矫正方向,图片预览,图片二进制数据流上传

项目运行方法:

1.clone项目到本地电脑

2.进入项目根目录

3.双击ImgProcess.html,即可在浏览器运行demo了。

项目中主要插件是:

src/processImg.js 和 src/exif.js

这两个插件是用来实现图片压缩和图片方向纠正的。

processImg.js依赖于exif.js,所以在使用的时候,必须先引入exif.js,然后再引入processImg.js

插件processImg.js和exif.js都是原生js编写的。所以不依赖第三方库,可以直接在任何前端项目中使用。

只需要先将exif.js引入,然后再将processImg.js引入即可。

exif.js 提供了 JavaScript 读取图像的原始数据的功能扩展,例如:拍照方向、相机设备型号、拍摄时间、ISO 感光度、GPS 地理位置等数据。

Exif.js 的 github 仓库地址:https://github.com/exif-js/exif-js/

浏览器兼容性:

插件的浏览器兼容性:IE10+,IE10以下的浏览器可能不兼容

插件详细讲解:

文章地址:https://juejin.im/post/5a9759a16fb9a0635b5360b3

声明:这个插件的初衷是教会大家如何自己编写图片压缩、方向纠正插件。上传和预览不是重点,重点是如何压缩和纠正方向,所以上传和预览没有放在插件processImg本身中,而是写在了demo中。

img_compress_rotate_preview_upload's People

Contributors

legend-li avatar

Watchers

 avatar  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.