Skip to main content

isSupportedImage 方法已被删除

¥The isSupportedImage method is removed

isSupportedImage 方法自 v4 以来一直在发出弃用警告,最终在 Strapi 5 中被删除。

¥The isSupportedImage method has been issuing a deprecation warning ever since v4, and is finally being removed in Strapi 5.

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

\🔌 此重大更改是否会影响插件?\
\🤖 此重大更改是否由 codemod 自动处理?\

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

isSupportedImage 方法受支持,但已弃用。

¥The isSupportedImage method is supported, but deprecated.

在 Strapi 5 中

¥In Strapi 5

isSupportedImage 方法已被删除。

¥The isSupportedImage method is removed.

开发者必须使用 isImage 检查文件是否为图片,或使用 isOptimizableImage 检查文件是否为可以优化的图片。

¥Developers must use either isImage to check if a file is an image, or isOptimizableImage to check if the file is an image that can be optimized.

手动迁移

¥Manual migration

重新组织你的 Strapi v4 代码以与 Strapi 5 isSupportedImage 保持一致请注意,Strapi v4 中的行为等同于 isOptimizableImage

¥Replace occurences of the isSupportedImage method in your code by the appropriate method, isImage or isOptimizableImage, depending on your needs. Note that the behavior in Strapi v4 was equivalent to isOptimizableImage.