webbuilders-group/silverstripe-next-gen-images

为 Silverstripe 添加了自动生成 WebP 图像的支持

安装: 220

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 5

分支: 4

开放问题: 0

类型:silverstripe-vendormodule

2.0.0 2024-05-16 18:37 UTC

This package is auto-updated.

Last update: 2024-09-16 19:26:02 UTC


README

CI

为 Silverstripe 添加了自动生成 WebP 图像的支持

维护者联系方式

需求

安装

composer require webbuilders-group/silverstripe-next-gen-images

使用

默认情况下,此模块将替换您在 WYSIWYG 中插入图像时使用的短代码,并在您在模板中使用带有自动生成 <picture> 标签的图像时使用标记(回退到最初上传的图像)。此模块还支持上传 WebP 图像并在支持浏览器的 WYSIWYG 中使用,但使用 WebP 图像时它们不会使用 <picture> 标签。

您还可以在模板中对 SilverStripe\Assets\Image 类或 WebP 调用 getWebP,例如 $MyImage.WebP 或甚至 $MyImage.ScaleWidth(100).WebP。在获得 WebP 后,您可以对 WebP 执行其他操作,就像对任何其他图像一样,例如 $MyImage.WebP.URL