innoweb/silverstripe-image-templated-shortcode

使用 SS 模板渲染短代码图像

安装: 47

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 1

开放问题: 0

类型:silverstripe-vendormodule

2.0.1 2024-06-24 05:31 UTC

This package is auto-updated.

Last update: 2024-09-24 05:59:14 UTC


README

概述

使用默认的 SS 图像模板 DBFile_image 渲染图像短代码(来自 WYSIWYG 编辑器)。

如果您想为 WYSIWYG 图像使用例如 响应式图像 或类似的工具,这将非常有用。

要求

  • Silverstripe 框架 5
  • Silverstripe Assets 2

注意:此版本与 Silverstripe 5 兼容。对于 Silverstripe 4,请参阅 1 版本分支

安装

使用 composer 安装模块

composer require innoweb/silverstripe-image-templated-shortcode dev-master

然后运行 dev/build。

使用方法

默认情况下,该模块使用 SS DBFile_image 模板来处理图像。您可以在主题中创建自己的模板,或者将此模块中的模板包含在主题堆栈中。

SilverStripe\View\SSViewer:
  themes:
    - '$public'
    - 'app'
    - 'yourtheme'
    - 'innoweb/silverstripe-image-templated-shortcode:/templates'
    - '$default'

您还可以更改所使用的模板

Innoweb\ImageTemplatedShortcode\ImageShortcodeHandler:
  template: 'Your_Template'

如果您使用 响应式图像 或其他使用不同模板的图像模块,建议为短代码使用自定义模板,以便原始的 DBFile_image 保持不变,用于在 CMS 中显示图像。(例如,如果您的响应式图像或懒加载功能需要 JavaScript,那么该脚本可能不在 CMS 中可用。)

许可证

BSD 3-Clause License,请参阅 许可证