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.

 Is this breaking change affecting plugins?Yes
 Is this breaking change automatically handled by a codemod?No

重大变更描述

🌐 Breaking change description

在 Strapi v4 中

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

🌐 The isSupportedImage method is supported, but deprecated.

在 Strapi 5 中

isSupportedImage 方法已被移除。

🌐 The isSupportedImage method is removed.

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

手动迁移

🌐 Manual migration

根据你的需求,将代码中 isSupportedImage 方法的出现替换为适当的方法 isImageisOptimizableImage。请注意,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.