|
1 | 1 | <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> |
2 | | -<h3 align="center">Example</h3> |
3 | | -<p align="center"><strong><code>@capacitor-community/example</code></strong></p> |
| 2 | +<h3 align="center">Capacitor Exif Plugin</h3> |
| 3 | +<p align="center"><strong><code>@capacitor-community/exif</code></strong></p> |
4 | 4 | <p align="center"> |
5 | | - Capacitor community plugin for something awesome. |
| 5 | + Capacitor community plugin for interacting with image exif metadata |
6 | 6 | </p> |
7 | 7 |
|
8 | 8 | <p align="center"> |
9 | 9 | <img src="https://img.shields.io/maintenance/yes/2024?style=flat-square" /> |
10 | | - <a href="https://github.com/capacitor-community/example/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/example/CI?style=flat-square" /></a> |
11 | | - <a href="https://www.npmjs.com/package/@capacitor-community/example"><img src="https://img.shields.io/npm/l/@capacitor-community/example?style=flat-square" /></a> |
| 10 | + <a href="https://github.com/capacitor-community/exif/actions?query=workflow%3A%22CI%22"><img src="https://img.shields.io/github/workflow/status/capacitor-community/exif/CI?style=flat-square" /></a> |
| 11 | + <a href="https://www.npmjs.com/package/@capacitor-community/exif"><img src="https://img.shields.io/npm/l/@capacitor-community/exif?style=flat-square" /></a> |
12 | 12 | <br> |
13 | | - <a href="https://www.npmjs.com/package/@capacitor-community/example"><img src="https://img.shields.io/npm/dw/@capacitor-community/example?style=flat-square" /></a> |
14 | | - <a href="https://www.npmjs.com/package/@capacitor-community/example"><img src="https://img.shields.io/npm/v/@capacitor-community/example?style=flat-square" /></a> |
| 13 | + <a href="https://www.npmjs.com/package/@capacitor-community/exif"><img src="https://img.shields.io/npm/dw/@capacitor-community/exif?style=flat-square" /></a> |
| 14 | + <a href="https://www.npmjs.com/package/@capacitor-community/exif"><img src="https://img.shields.io/npm/v/@capacitor-community/exif?style=flat-square" /></a> |
15 | 15 | <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> |
16 | 16 | <a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-0-orange?style=flat-square" /></a> |
17 | 17 | <!-- ALL-CONTRIBUTORS-BADGE:END --> |
18 | 18 | </p> |
19 | 19 |
|
| 20 | +# Table of Contents |
| 21 | + |
| 22 | +- [Maintainers](#maintainers) |
| 23 | +- [About](#about) |
| 24 | +- [Plugin versions](#plugin-versions) |
| 25 | +- [Supported Platforms](#supported-platforms) |
| 26 | +- [Installation](#installation) |
| 27 | +- [Configuration](#configuration) |
| 28 | +- [API](#api) |
| 29 | +- [Troubleshooting](#troubleshooting) |
| 30 | + |
20 | 31 | ## Maintainers |
21 | 32 |
|
22 | | -| Maintainer | GitHub | Social | |
23 | | -| -----------| -------| -------| |
24 | | -| Ionitron (example) | [Ionitron](https://github.com/ionitron) | [@ionitron](https://twitter.com/ionitron) | |
| 33 | +| Maintainer | GitHub | Active | |
| 34 | +| ---------- | ------------------------------- | ------ | |
| 35 | +| ryaa | [ryaa](https://github.com/ryaa) | yes | |
| 36 | + |
| 37 | +## About |
| 38 | + |
| 39 | +This plugins allows reading and setting coordinates to image files. |
| 40 | +This plugin has been primarity implemented to enhance other plugins which require coordinates to be added to images, for example https://github.com/capacitor-community/camera-preview/issues/164. |
| 41 | + |
| 42 | +**Features:** |
| 43 | + |
| 44 | +- support reading coordinates from image files |
| 45 | +- support setting coordinates to image files |
| 46 | +- supports Android and iOS platforms |
| 47 | + |
| 48 | +**NOTE**: The plugin version 6.0.0 is compatible with Capacitor 6 |
| 49 | + |
| 50 | +## Plugin versions |
| 51 | + |
| 52 | +| Capacitor version | Plugin version | |
| 53 | +| ----------------- | -------------- | |
| 54 | +| 6.x | 6.x | |
| 55 | + |
| 56 | +## Supported Platforms |
| 57 | + |
| 58 | +- iOS |
| 59 | +- Android |
25 | 60 |
|
26 | 61 | ## Installation |
27 | 62 |
|
28 | | -TODO |
| 63 | +```bash |
| 64 | +npm install @capacitor-community/exif |
| 65 | +npx cap sync |
| 66 | +``` |
29 | 67 |
|
30 | 68 | ## Configuration |
31 | 69 |
|
32 | | -TODO |
| 70 | +### Android |
| 71 | +This plugin will use the following project variables (defined in your app's variables.gradle file): |
| 72 | +``` |
| 73 | +androidxExifInterfaceVersion: version of androidx.exifinterface:exifinterface (default: 1.3.6) |
| 74 | +``` |
| 75 | + |
| 76 | +## API |
| 77 | + |
| 78 | +<docgen-index> |
| 79 | + |
| 80 | +* [`setCoordinates(...)`](#setcoordinates) |
| 81 | +* [`getCoordinates(...)`](#getcoordinates) |
| 82 | +* [Interfaces](#interfaces) |
| 83 | + |
| 84 | +</docgen-index> |
| 85 | + |
| 86 | + |
| 87 | +<docgen-api> |
| 88 | +<!--Update the source file JSDoc comments and rerun docgen to update the docs below--> |
| 89 | + |
| 90 | +### setCoordinates(...) |
| 91 | + |
| 92 | +```typescript |
| 93 | +setCoordinates(options: SetCoordinatesOptions) => Promise<void> |
| 94 | +``` |
| 95 | + |
| 96 | +Set the coordinates to the image EXIF metadata. |
| 97 | + |
| 98 | +| Param | Type | |
| 99 | +| ------------- | ----------------------------------------------------------------------- | |
| 100 | +| **`options`** | <code><a href="#setcoordinatesoptions">SetCoordinatesOptions</a></code> | |
| 101 | + |
| 102 | +**Since:** 6.0.0 |
| 103 | + |
| 104 | +-------------------- |
| 105 | + |
| 106 | + |
| 107 | +### getCoordinates(...) |
| 108 | + |
| 109 | +```typescript |
| 110 | +getCoordinates(options: GetCoordinatesOptions) => Promise<{ lat: number; lng: number; } | undefined> |
| 111 | +``` |
| 112 | + |
| 113 | +Get the coordinates from the image EXIF metadata. |
| 114 | + |
| 115 | +| Param | Type | |
| 116 | +| ------------- | ----------------------------------------------------------------------- | |
| 117 | +| **`options`** | <code><a href="#getcoordinatesoptions">GetCoordinatesOptions</a></code> | |
| 118 | + |
| 119 | +**Returns:** <code>Promise<{ lat: number; lng: number; }></code> |
| 120 | + |
| 121 | +**Since:** 6.0.0 |
| 122 | + |
| 123 | +-------------------- |
| 124 | + |
| 125 | + |
| 126 | +### Interfaces |
| 127 | + |
| 128 | + |
| 129 | +#### SetCoordinatesOptions |
| 130 | + |
| 131 | +| Prop | Type | Description | Since | |
| 132 | +| ----------------- | ------------------- | ------------------------------------------------------------------ | ----- | |
| 133 | +| **`pathToImage`** | <code>string</code> | The path to the image to set the coordinates to the EXIF metadata. | 6.0.0 | |
| 134 | +| **`lat`** | <code>number</code> | The latitude of the image coordinates. | 6.0.0 | |
| 135 | +| **`lng`** | <code>number</code> | The longitude of the image coordinates. | 6.0.0 | |
| 136 | + |
| 137 | + |
| 138 | +#### GetCoordinatesOptions |
| 139 | + |
| 140 | +| Prop | Type | Description | Since | |
| 141 | +| ----------------- | ------------------- | ---------------------------------------------------------------- | ----- | |
| 142 | +| **`pathToImage`** | <code>string</code> | The path to the image to get the coordinates from EXIF metadata. | 6.0.0 | |
| 143 | + |
| 144 | +</docgen-api> |
33 | 145 |
|
34 | 146 | ## Usage |
35 | 147 |
|
36 | | -TODO |
| 148 | +### Set coordinates to image file |
| 149 | + |
| 150 | +``` |
| 151 | +import { Exif } from '@capacitor-community/exif'; |
| 152 | +
|
| 153 | +const options: SetCoordinatesOptions = { |
| 154 | + pathToImage, |
| 155 | + lat, |
| 156 | + lng |
| 157 | +}; |
| 158 | +await this.exifPlugin.setCoordinates(options); |
| 159 | +``` |
| 160 | + |
| 161 | +### Read coordinates from image file |
| 162 | + |
| 163 | +``` |
| 164 | +import { Exif } from '@capacitor-community/exif'; |
| 165 | +
|
| 166 | +const options: GetCoordinatesOptions = { pathToImage }; |
| 167 | +const coordinates: { |
| 168 | + lat: number; |
| 169 | + lng: number; |
| 170 | +} | undefined = await this.exifPlugin.getCoordinates(options); |
| 171 | +``` |
| 172 | + |
0 commit comments