Appwrite
Unpic can transform images with Appwrite using the appwrite
provider. It can be
used with Unpic framework components, or you can use the base unpic
libary to generate
image URLs directly.
You can import the appwrite
provider from the unpic
package using a subpath import:
import { transform } from 'unpic/providers/appwrite';
If using an Unpic component, you can optionally pass custom operations and options to the
component using an object with a appwrite
key. This is lets you use extra features supported
by Appwrite, or set custom configuration options.
This example uses @unpic/astro
, but the same applies to any Unpic component:
---
import { Image } from '@unpic/astro';
---
<Image
src="image.jpg"
width={800}
height={600}
options={{
"appwrite": {
// appwrite options here
}
}}
operations={{
"appwrite": {
// appwrite operations here
}
}}
/>
In supported frameworks you can also import the base component and pass the transformer to it directly. This lets you create a custom component that doesn’t need to include and other transformer code.
---
import { Image } from '@unpic/astro/base';
import { transform } from 'unpic/providers/appwrite';
---
<Image
src="image.jpg"
width={800}
height={600}
transformer={transformer}
/>
Types
The appwrite
provider supports the following arguments:
Options
The appwrite
provider does not support any extra configuration options.
Operations
width
Type: number
Set the width of the output image in pixels. Output image will be resized keeping the aspect ratio intact.
height
Type: number
Set the height of the output image in pixels. Output image will be resized keeping the aspect ratio intact.
gravity
Type: "center" | "top-left" | "top" | "top-right" | "left" | "right" | "bottom-left" | "bottom" | "bottom-right"
Set the gravity while cropping the output image, providing either width, height, or both.
quality
Type: number
Set the quality of the output image
borderWidth
Type: number
Set a border with the given width in pixels for the output image.
borderColor
Type: string
Set a border-color for the output image. Accepts any valid hex color value without the leading ’#‘.
borderRadius
Type: number
Set the border-radius in pixels.
opacity
Type: number
Set opacity for the output image. Works only with output formats supporting alpha channels, like ‘png’.
rotation
Type: number
Rotates the output image by a degree.
background
Type: string
Set a background-color for the output image. Accepts any valid hex color value without the leading ’#‘. Works only with output formats supporting alpha channels, like ‘png’.
output
Type: AppwriteOutputFormats
Set the output image format. If not provided, will use the original image’s format. Acceptable values include: “jpeg”, “jpg”, “png”, “webp”, “avif”, “gif”
format
Type: "jpeg" | "jpg" | "png" | "webp" | "avif" | "gif"
This page is auto-generated from the appwrite
provider types.
See anything wrong or missing? Suggest a change on GitHub.