0.1.1 • Published 5 years ago

fix-orientation-capacitor v0.1.1

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

fix-orientation-capacitor

Rotate images generated by Ionic Capacitor Camera Plugin

This package is intended for an Ionic Capacitor app only. For correcting orientation of general images, consult fix-orientation

Ionic Capacitor's Camera Plugin has a correctOrientation attribute that does not work in all Android devices. This package fixes that issue. This code is based on juliangruber's fix-orientation and works with @capacitor/core": 1.1.1.

Upgrade

Note that with Capacitor version 1.1.1, resultType is changed from CameraResultType.Base64 to CameraResultType.DataUrl

Usage

import { CameraResultType, CameraSource, Plugins } from "@capacitor/core";
import fixOrientation from 'fix-orientation-capacitor';

const { Camera } = Plugins;
// notice the attribute 'correctOrientation' must be set to false
const image = await Camera.getPhoto({
                quality: 60,
                width: 1280,
                allowEditing: false,
                resultType: CameraResultType.DataUrl, // please note with the 1.1.1 upgrade, this is no longer using Base64
                source: CameraSource.Prompt,
                correctOrientation: false });

const fixed = await fixOrientation(image);

Installation

With npm do:

npm install fix-orientation-capacitor

License

(MIT)

Copyright (c) 2019 Calvin Ho

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0.1.1

5 years ago

0.1.0

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago