Skip to content

Commit a95fe51

Browse files
authored
improved documentation
2 parents c3382c0 + ef245b1 commit a95fe51

File tree

16 files changed

+593
-426
lines changed

16 files changed

+593
-426
lines changed

dictionary.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ module.exports = [
5454
/^mitchell/,
5555
/^fourier/,
5656
/^const/,
57+
/^json/,
58+
/^invertase/,
59+
/^firebase/,
60+
/^href/,
5761
];

docs.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
"Storage Image Processing Api",
99
[
1010
["Overview", "/storage-image-processing-api"],
11-
["Getting started", "/storage-image-processing-api/getting-started"],
1211
["Input", "/storage-image-processing-api/input"],
1312
["Operations", "/storage-image-processing-api/operations"],
14-
["Types", "/storage-image-processing-api/types"],
1513
["Output", "/storage-image-processing-api/output"],
1614
["Caching", "/storage-image-processing-api/caching"],
17-
["Error Handling", "/storage-image-processing-api/error-handling"]
15+
["Error Handling", "/storage-image-processing-api/error-handling"],
16+
["Types", "/storage-image-processing-api/types"]
1817
]
1918
]
2019
]

docs/storage-image-processing-api/getting-started.mdx

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,72 @@
1-
# Storage Image Processing Api
1+
# Storage Image Processing API
22

3-
Welcome to Storage Image Processing Api!
3+
The Storage Image Processing API extension (`storage-image-processing-api`) lets you optimize and transform images in the [Cloud Storage](https://firebase.google.com/docs/storage) bucket via a powerful HTTP API. The API provides more than 30 different operations to enhance and manipulate your images, including image composition, cropping, flipping, color reduction, sharpening, filtering, and much more. See the full list of available operations in the [Operations](/operations) documentation.
44

5-
Optimize and transform images from your Cloud Storage buckets via a powerful HTTP API. Library Supports over 30 different image operations to optimize and manipulate your images.
5+
<video width="100%" controls muted autoPlay loop>
6+
<source
7+
src="https://user-images.githubusercontent.com/35961879/175304684-9bb464b6-996e-4923-b65b-cb1afd9519b4.mp4"
8+
type="video/mp4"
9+
/>
10+
Your browser does not support the video tag.
11+
</video>
612

7-
## Getting started
13+
## Install the extension
814

9-
Follow our guide on how to setup and process images [here](/getting-started).
15+
To install the extension, follow the steps on the [Install Firebase Extension](https://firebase.google.com/docs/extensions/install-extensions) page. In summary, do one of the following:
16+
17+
- **Firebase console:** Click the following link:
18+
19+
<a
20+
href="https://console.firebase.google.com/project/_/extensions/install?ref=invertase/storage-image-processing-api"
21+
target="_blank"
22+
>
23+
<img
24+
src="https://github.com/FirebaseExtended/experimental-extensions/raw/next/install-extension.png?raw=true"
25+
alt="Install the Storage Image Processing API extension"
26+
/>
27+
</a>
28+
29+
- **CLI:** Run the following command:
30+
31+
```bash
32+
firebase ext:install invertase/storage-image-processing-api --project=projectId-or-alias
33+
```
34+
35+
During the installation of the extension, you will be prompted to specify a number of configuration parameters:
36+
37+
- **Cloud Functions location:**
38+
39+
Select the location of where you want to deploy the functions created for this extension. You usually want a location close to your database. For help selecting a location, refer to the [location selection guide](https://firebase.google.com/docs/functions/locations).
40+
41+
- **Cloud Storage bucket:**
42+
43+
Cloud storage bucket, where the images to be processed are located.
44+
45+
- **Cloud Storage path for caching images:**
46+
47+
A relative path in which the processed images are cached in the specified Cloud Storage bucket. If you prefer to store resized images at the default location, leave this field empty.
48+
49+
- **Allowed CORS origins:**
50+
51+
A comma-delimited value of allowed `CORS` origins. Use the default of `*` to allow all origins. This is useful to lock down your API and only allow your own website to embed the images directly. Note this will not prevent non-browser requests from accessing your API.
52+
53+
## Use the extension
54+
55+
After installation, a new Cloud Function called `process` will be added to your project. You can make HTTP requests to this function specifying a method of `GET` and a single query parameter `operations` with a JSON array of operations you'd like to perform. For example:
56+
57+
```bash
58+
curl -X GET \
59+
https://{LOCATION}-{PROJECT_ID}.cloudfunctions.net/{EXTENSION_INSTANCE_ID}-handler/process?operations=...
60+
```
61+
62+
- **`{LOCATION}`**: The Cloud Functions location that was specified during the installation of the extension.
63+
- **`{PROJECT_ID}`**: The Firebase project ID.
64+
- **`{EXTENSION_INSTANCE_ID}`**: The extension instance ID.
65+
66+
### Operations
67+
68+
The `operations` query parameter is a JSON array of operations to perform. Each operation is a JSON object with an `operation` property specifying the operation to perform and other properties depending on the operation.
69+
70+
The first operation in the array must be an `input` operation. This operation specifies the image to be processed. Read the [input](/input) operation documentation for more information.
71+
72+
Also, the last operation in the array must be an `output` operation. This operation specifies the `format` of the image to be created. Read the [output](/output) operation documentation for more information.
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
# Input
22

3-
A `mandatory` operation when requesting an image.
3+
## Google Cloud Storage
44

5-
This is the image source of the image you want to process.
5+
This is a valid google cloud storage url of an existing image. For example:
66

7-
## Create
8-
9-
This has no source and will generate an image based on the operations provided.
7+
```json
8+
{ "operation": "input", "type": "gcs", "source": "gs://bucket/path/to/file" }
9+
```
1010

11-
Example: /input~`type:url~create`
11+
## URL
1212

13-
## Gsc
13+
A generic url of an existing image. For example:
1414

15-
This is a valid google cloud storage url of an existing image.
15+
```json
16+
{ "operation": "input", "type": "url", "url": "https://example.com/image.jpg" }
17+
```
1618

17-
Example: input~`type:url~gsc`:exampleimage.com
18-
19-
## Url
19+
## Create
2020

21-
A generic url of an existing image
21+
This has no source and will generate an image based on the operations provided. For example:
2222

23-
Example: /input~`type:url~url`:https://www.exampleimage.com
23+
```json
24+
{ "operation": "input", "type": "create" }
25+
```

0 commit comments

Comments
 (0)