stnvh/silverstripe-responsive-images-srcset

响应式图片模块的插件,用于使用 img/srcset 标准

0.1.0 2015-12-16 12:10 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:26:08 UTC


README

Latest Stable Version License

为响应式图片模块使用 img/srcset 标准的插件

由 Stan Hutcheon - Bigfork Ltd 提供

安装

Composer

composer require "stnvh/silverstripe-responsive-images-srcset" "0.x"

下载

将此存储库克隆到您的 silverstripe 安装目录的根目录。

用法

查看响应式图片模块用法以获取基本配置。

为方便起见,已添加自动生成视网膜图像的选项。可以通过 yml 启用

ResponsiveImageExtension:
  sets:
    GallerySet:
      method: CroppedFocusedImage
      sizes:
        - {query: "(min-width: 640px)", size: 820x640}
        - {query: "(min-width: 940px)", size: 1128x768}
      default_size: 960x480
	  retina: true

注意

  • 需要 polyfill 以支持 IE 11 及以下版本。
  • 此插件仅针对 min-width 查询进行了测试。

通过 composer 安装后,您必须执行 /dev/build 并刷新缓存。