Skip to main content

媒体库简介

¥Introduction to the Media Library

媒体库是一个 Strapi 插件,默认情况下始终处于激活状态且无法停用。当应用处于开发和生产环境中时都可以访问它。

¥The Media Library is a Strapi plugin that is always activated by default and cannot be deactivated. It is accessible both when the application is in a development and production environment.

管理员可以从以下位置访问媒体库

¥Administrators can access the Media Library from

ML icon

管理面板主导航中的媒体库。

¥Media Library in the main navigation of the admin panel.

Media Library overview, annotatedMedia Library overview, annotated

媒体库显示在应用中上传的所有资源,无论是通过媒体库本身还是在管理媒体字段时通过内容管理器。上传到媒体库的资源可以使用 内容管理者 插入到内容类型中。

¥The Media Library displays all assets uploaded in the application, either via the Media Library itself or via the Content Manager when managing a media field. Assets uploaded to the Media Library can be inserted into content-types using the Content Manager.

从媒体库中,可以:

¥From the Media Library, it is possible to:

  • 上传新资源(参见 添加资源)或创建新文件夹(参见 使用文件夹组织资源)(1),

    ¥upload a new asset (see adding assets) or create a new folder (see organizing assets with folders) (1),

  • 对资源和文件夹进行排序或设置过滤器 (2) 以更轻松地查找资源和文件夹,

    ¥sort the assets and folders or set filters (2) to find assets and folders more easily,

  • 在列表视图之间切换

    ¥toggle between the list view

List icon

和网格视图

¥and the grid view

Grid icon

显示资源、访问设置

¥to display assets, access settings

Settings icon

配置视图,并进行文本搜索

¥to configure the view, and make a textual search

Search icon

(3) 查找特定资源或文件夹,

¥(3) to find a specific asset or folder,

  • 以及查看、浏览和管理文件夹 (4)。

    ¥and view, navigate through, and manage folders (4).

💡 提示

单击搜索图标

¥Click the search icon

Search icon

在用户界面的右侧,使用文本搜索并更快地找到你的资源或文件夹之一!

¥on the right side of the user interface to use a text search and find one of your assets or folders more quickly!

过滤资源

¥Filtering assets

在界面左侧的文件夹和资源列表的正上方,会显示一个“过滤器”按钮。它允许设置一个或多个基于条件的过滤器,这些过滤器相互叠加(即,如果你设置多个条件,则仅显示与所有条件匹配的资源)。

¥Right above the list of folders and assets, on the left side of the interface, a Filters button is displayed. It allows setting one or more condition-based filters, which add to one another (i.e. if you set several conditions, only the assets that match all the conditions will be displayed).

FiltersFilters

要设置新过滤器:

¥To set a new filter:

  1. 单击“过滤器”按钮。

    ¥Click on the Filters button.

  2. 单击第一个下拉列表以选择要应用条件的字段。

    ¥Click on the 1st drop-down list to choose the field on which the condition will be applied.

  3. 单击第二个下拉列表以选择要应用的条件类型。

    ¥Click on the 2nd drop-down list to choose the type of condition to apply.

  4. 对于基于要过滤的资源类型的条件,请单击第三个下拉列表,然后选择要包含或排除的文件类型。对于基于日期和时间的条件(即 createdAt 或 updatedAt 字段),单击左侧字段以选择日期,然后单击右侧字段以选择时间。

    ¥For conditions based on the type of asset to filter, click on the 3rd drop-down list and choose a file type to include or exclude. For conditions based on date and time (i.e. createdAt or updatedAt fields), click on the left field to select a date and click on the right field to select a time.

  5. 单击添加过滤器按钮。

    ¥Click on the Add filter button.

✏️ 注意

激活后,过滤器将显示在“过滤器”按钮旁边。可以通过单击删除图标将其删除

¥When active, filters are displayed next to the Filters button. They can be removed by clicking on the delete icon

Clear icon

.

对资源进行排序

¥Sorting assets

SortSort

在界面左侧的文件夹和资源列表上方,显示“排序依据”按钮。它允许按上传日期、字母顺序或更新日期显示资源。单击该按钮并在列表中选择一个选项即可自动显示已排序的资源。

¥Just above the list of folders and assets, on the left side of the interface, a Sort by button is displayed. It allows to display assets by upload date, alphabetical order or date of update. Click on the button and select an option in the list to automatically display the sorted assets.

配置视图

¥Configuring the view

就在文件夹和资源列表的上方,在界面的右侧,有一组 3 个按钮。点击中间的那个

¥Just above the list of folders and assets, on the right side of the interface, there is a group of 3 buttons. Click on the middle one

Settings icon

配置媒体库的默认视图。

¥to configure the default view for the Media library.

Configure the viewConfigure the view

从那里你可以:

¥From there you can:

  • 使用每页条目下拉列表定义默认显示的资源数量

    ¥Use the Entries per page dropdown to define the number of assets displayed by default

  • 使用默认排序顺序下拉列表定义资源显示的默认顺序。当你在媒体库中进行 对资源进行排序 时,可以覆盖此设置。

    ¥Use the Default sort order dropdown the define the default order in which assets are displayed. This can be overriden when you sort assets in the Media Library.

这两个设置均用作媒体库和 内容管理器媒体上传模式 中的默认设置。此处保存的设置对于所有用户来说是整个 Strapi 项目的全局设置。

¥Both settings are used as the defaults in the Media Library and in the Content Manager media upload modal. The settings saved here are global across the entire Strapi project for all users.