|
1 |
| -# Storage Image Processing Api |
| 1 | +# Storage Image Processing API |
2 | 2 |
|
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. |
4 | 4 |
|
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> |
6 | 12 |
|
7 |
| -## Getting started |
| 13 | +## Install the extension |
8 | 14 |
|
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. |
0 commit comments