Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

image-autorotate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-autorotate

rotate image before upload

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

image-autorotate

Upload your pictures in js while keeping orientation. In-browser library. Use lazy calculation, so it's all asynchronous

Use case

In your HTML :

<input type="file" onClick="upload()">
  import OrientedImage from 'image-autorotate';

  async upload(event) {
    const file = event.target.value;

    const reader = new OrientedImage(file);

    /**
    * Use getFile() to retrieve the image with orientation
    * - url is the base64 image
    * - blob is the blob corresponding to the file
    */
    const { url, blob } = await reader.getFile()
      
      /**
      * If an error occurs, you can fallback to the original (i.e non rotated with exif) file instead
      */
      .catch(() => reader.getOriginalFile());
    
  }

Tested with

  • Chrome 62
  • Firefox 57
  • IE 11
  • Edge 16

FAQs

Package last updated on 01 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc