tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Photo/Video Cover Thumbnail

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-01-07 14:15:04

Description

To obtain image/video cover thumbnails.
Note:
The video cover uses the first frame of the video.
For photos or video covers, prioritize intelligent scaling and cropping to {Size}px × {Size}px using Face Recognition. If no face is detected, perform centered scaling and cropping to {Size}px × {Size}px. If the {Size} parameter is not specified, use the original photo or video cover. Finally, perform a 302 redirect to the corresponding image URL.
You can directly specify this URL in the parameters for image usage, such as in the Mini Program <image> tag, HTML <img> tag, or Mini Program wx.previewImage API, and so on. This API will automatically redirect (302) to the actual image URL.
If the file does not belong to a previewable media type, it will redirect to the download link of the file.

Request

Request Example

GET /api/v1/file/`{LibraryId}`/`{SpaceId}`/`{FilePath}`?preview&size=`{Size}`&scale=`{Scale}`&width_size=`{WidthSize}`&height_size=`{HeightSize}`&frame_number=`{FrameNumber}`&access_token=`{AccessToken}`&user_id=`{UserId}`

Request Parameter

Request parameters
Description
Type
Required or Not
LibraryId
Media Library ID, obtained after creating a media library in the Media Hosting console. See Create Media Library
String
Yes
SpaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as a hyphen (`-`). If the media library is in multi-tenant mode, you must specify this parameter. See Create Tenant Space
String
No
FilePath
Complete file path, such as foo/bar/file.docx. Please refer to View File Details
String
Yes
Size
Scale size
String
No
Scale
Scale proportionally by percentage. This parameter is valid only when Size is not specified.
Int
No
WidthSize
Scale the width. If height is not specified, it will be proportionally scaled. This parameter is valid only when Size and Scale are not specified.
Int
No
HeightSize
Scale the height. If width is not specified, it will be proportionally scaled. This parameter is valid only when Size and Scale are not specified.
Int
No
FrameNumber
Number of frames Frame processing for GIFs
Int
No
AccessToken
Access token. For Public Read Media Library or tenant space, this parameter is not specified, otherwise you must specify this parameter. Please see Generate Access Token
String
No
UserId
User identity recognition. When the access token has admin privileges and the user identity recognition during token application is empty, it is used to temporarily specify user identity. For details, see Generate Access Token API.
String
No

Request Body

This request has no request body.

Response

Response code

Successfully obtained, returns HTTP 200 OK.
Redirect, returns HTTP 302 Found, response header Location contains the URL that can be directly used to show or download the file.

Response Body

The response body returns file content.

Error Codes

This request operation has no special error messages. For common error messages, see Error Codes.


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan