Skip to content

Commit d5b52cb

Browse files
committed
Initial commit
1 parent c0bf8b1 commit d5b52cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5058
-14
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
dist

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=false

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.11.1

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
dist

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## v6.0.0
6+
7+
- initial release

CONTRIBUTING.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
11
# Contributing
22

3-
TODO
3+
This guide provides instructions for contributing to this Capacitor plugin.
4+
5+
## Developing
6+
7+
### Local Setup
8+
9+
1. Fork and clone the repo.
10+
2. Install the dependencies.
11+
12+
```shell
13+
npm install
14+
```
15+
16+
### Scripts
17+
18+
#### `npm run build`
19+
20+
Build the plugin web assets and generate plugin API documentation using [`@capacitor/docgen`](https://github.com/ionic-team/capacitor-docgen).
21+
22+
It will compile the TypeScript code from `src/` into ESM JavaScript in `dist/esm/`. These files are used in apps with bundlers when your plugin is imported.
23+
24+
Then, Rollup will bundle the code into a single file at `dist/plugin.js`. This file is used in apps without bundlers by including it as a script in `index.html`.
25+
26+
#### `npm run verify`
27+
28+
Build and validate the web and native projects.
29+
30+
This is useful to run in CI to verify that the plugin builds for all platforms.
31+
32+
#### `npm run lint` / `npm run fmt`
33+
34+
Check formatting and code quality, autoformat/autofix if possible.
35+
36+
This template is integrated with ESLint, Prettier, and SwiftLint. Using these tools is completely optional, but the [Capacitor Community](https://github.com/capacitor-community/) strives to have consistent code style and structure for easier cooperation.
37+
38+
## Publishing
39+
40+
There is a `prepublishOnly` hook in `package.json` which prepares the plugin before publishing, so all you need to do is run:
41+
42+
```shell
43+
npm publish
44+
```
45+
46+
> **Note**: The [`files`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it.

CapacitorCommunityExif.podspec

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'json'
2+
3+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4+
5+
Pod::Spec.new do |s|
6+
s.name = 'CapacitorCommunityExif'
7+
s.version = package['version']
8+
s.summary = package['description']
9+
s.license = package['license']
10+
s.homepage = package['repository']['url']
11+
s.author = package['author']
12+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14+
s.ios.deployment_target = '13.0'
15+
s.dependency 'Capacitor'
16+
s.swift_version = '5.1'
17+
end

Package.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// swift-tools-version: 5.9
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "CapacitorCommunityExif",
6+
platforms: [.iOS(.v13)],
7+
products: [
8+
.library(
9+
name: "CapacitorCommunityExif",
10+
targets: ["ExifPlugin"])
11+
],
12+
dependencies: [
13+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main")
14+
],
15+
targets: [
16+
.target(
17+
name: "ExifPlugin",
18+
dependencies: [
19+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
20+
.product(name: "Cordova", package: "capacitor-swift-pm")
21+
],
22+
path: "ios/Sources/ExifPlugin"),
23+
.testTarget(
24+
name: "ExifPluginTests",
25+
dependencies: ["ExifPlugin"],
26+
path: "ios/Tests/ExifPluginTests")
27+
]
28+
)

README.md

Lines changed: 149 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,172 @@
11
<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>
44
<p align="center">
5-
Capacitor community plugin for something awesome.
5+
Capacitor community plugin for interacting with image exif metadata
66
</p>
77

88
<p align="center">
99
<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>
1212
<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>
1515
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
1616
<a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-0-orange?style=flat-square" /></a>
1717
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1818
</p>
1919

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+
2031
## Maintainers
2132

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
2560

2661
## Installation
2762

28-
TODO
63+
```bash
64+
npm install @capacitor-community/exif
65+
npx cap sync
66+
```
2967

3068
## Configuration
3169

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&lt;{ lat: number; lng: number; }&gt;</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>
33145

34146
## Usage
35147

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+

android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

0 commit comments

Comments
 (0)