Files and Images – Flutter feeds
Mục lục bài viết
Files and Images
Confused about “Files and Images”?
Let us know how we can improve our documentation:
- On This Page:
- Upload
- Delete
- Image Processing
- Parameters
- Resize
- Crop
This API endpoint allows you to upload files and to process your images (eg. create image thumbnails).
Upload
Copied!
Confused about “Upload”?
Let us know how we can improve our documentation:
Image and files have separate API endpoints (e.g. images can be resized, whereas files cannot). Once the upload is completed the URL of the file/image is returned and is ready for use.
The returned URL is served via CDN and can be requested by anyone. In order to avoid resource enumeration attacks, a unique signature is added. Manipulating the returned URL will likely result in HTTP errors. Every time that you retrieve the activity/reaction where the file/image was uploaded, the URL will be refreshed.
Upload size is limited to 10MB, any attempt to upload a larger file will return an HTTP 413 error. If you need to upload larger files then we recommend using your own CDN.
Delete
Copied!
Confused about “Delete”?
Let us know how we can improve our documentation:
Files and images can be deleted using their URL.
The file/image will still be available on the CDN until their cache is expired.
Image Processing
Copied!
Confused about “Image Processing”?
Let us know how we can improve our documentation:
Once an image is uploaded, it is possible to create variants of the same in different sizes. The image to manipulate is selected using its URL. A new URL is then returned by the API.
Parameters
Copied!
Confused about “Parameters”?
Let us know how we can improve our documentation:
nametypedescriptiondefaultoptionalresizestringthe strategy used to adapt the image the new dimensionsclip✓cropstringthe cropping modecenter✓wnumberthe final width of the processed image-✓hnumberthe final height of the processed image. -✓
Resize
Copied!
Confused about “Resize”?
Let us know how we can improve our documentation:
The resize parameter determines how the new image dimensions are applied. The default value for this parameter is “clip”.
Allowed values:
-
clip fits the image within the width and height boundaries without cropping or changing the aspect ratio.
-
crop applies the new dimensions and keeps the aspect ratio by cropping the parts of the image outside of the new boundaries. You can use the crop parameter to control how the cropping is done.
-
scale applies the new dimensions to the image. This method does not respect the aspect ratio and can create distorted images.
-
fill same as “clip” but the resulting image will have the exact dimensions requested and filled with a solid background color.
Crop
Copied!
Confused about “Crop”?
Let us know how we can improve our documentation:
When resizing the image with a crop you can specify the cropping direction. By default, images are cropped started from their center. You combine directions in order to pick corners. Eg. “top,left” will use the top left corner as cropping position.
Allowed values:
-
top, bottom, left, right, center