Appwrite icon

Appwrite

Interact with Appwrite API

Actions181

Storage → Get File Preview

AI-generated

Overview

This node interacts with the Appwrite API to retrieve a preview of a file stored in an Appwrite storage bucket. It is useful for scenarios where users need to generate and obtain image previews or thumbnails of stored files with customizable options such as size, cropping, quality, borders, opacity, rotation, background color, and output format. Practical examples include generating image previews for display in web applications, resizing images for thumbnails, or applying visual effects before further processing or sharing.

Use Case Examples

  1. Generating a 200x200 pixel preview of an image file with a centered crop and 80% quality for use in a web gallery.
  2. Creating a circular preview of a profile picture with a border and transparent background for user avatars.
  3. Obtaining a rotated and resized preview of a document thumbnail for display in a document management system.

Properties

Name Meaning
Bucket ID The ID of the storage bucket where the file is stored.
File ID The ID of the file to retrieve the preview for.
Preview Options Various options to customize the file preview, including width, height, crop gravity, quality, border width, border color, border radius, opacity, rotation, background color, and output format.

Output

JSON

  • previewUrl - URL of the generated file preview image.

Dependencies

  • Appwrite API key credential for authentication and access to the storage service.

Troubleshooting

  • Ensure the provided Bucket ID and File ID are correct and exist in the Appwrite storage service to avoid 'file not found' errors.
  • Verify that the API key credential has sufficient permissions to access the storage bucket and retrieve file previews.
  • Check that the preview options are within valid ranges (e.g., quality between 0-100, opacity between 0-1, rotation between 0-360) to prevent errors or unexpected results.
  • If the preview generation fails, confirm that the file type supports preview generation and that the Appwrite storage service is operational.

Links

Discussion