Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image.
Request Request Example
Shell
JavaScript
Java
Swift
curl--location--request GET 'https://appwrite.io/v1/storage/files//preview'
Response Response Example
{}
Request
Path Params
fileId
string
required
File unique ID
Query Params
width
integer
optional
Resize preview image width, Pass an integer between 0 to 4000.
height
integer
optional
Resize preview image height, Pass an integer between 0 to 4000.
gravity
string
optional
Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
quality
integer
optional
Preview image quality. Pass an integer between 0 to 100. Defaults to 100.
borderWidth
integer
optional
Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
borderColor
string
optional
Preview image border color. Use a valid HEX color, no # is needed for prefix.
borderRadius
integer
optional
Preview image border radius in pixels. Pass an integer between 0 to 4000.
opacity
number
optional
Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
rotation
integer
optional
Preview image rotation in degrees. Pass an integer between 0 and 360.
background
string
optional
Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
output
string
optional
Output format type (jpeg, jpg, png, gif and webp).