【问题标题】:Apostrophe-CMS Schema ImageApostrophe-CMS 模式图像
【发布时间】:2019-01-13 10:24:20
【问题描述】:

我一直在尝试找到一种处理架构内部图像的好方法,并且想知道是否存在我一直缺少的内置方法。最终目标是拥有一个模式字段,用户可以在其中从图像库中选择图像(而不是简单的附件上传),同时能够使用通常的裁剪工具和选项(大小、比例等)用于撇号图像小部件。我目前正在使用带有 apostrophe-image 类型的 joinByOne 来使其有点工作,但据我所知,裁剪不可用,而且我无法指定纵横比。这是我正在尝试使用的当前架构定义:

{
    name: '_storeImage',
    label: 'Store Image',
    withType: 'apostrophe-image',
    type: 'joinByOne',
    help: 'The image that will show on the main store page.'
}

如果没有别的,有没有办法将选项传递给撇号图像以限制纵横比并启用裁剪工具,还是仅在小部件编辑器中可用?

谢谢!

【问题讨论】:

    标签: apostrophe-cms


    【解决方案1】:

    使用内置的apostrophe-images-widgets 小部件选择图像

    {
      name: 'myImage',
      label: 'Image',
      type: 'singleton',
      widgetType: 'apostrophe-images',
      options: {
        aspectRatio: [ 4, 3 ],
        minSize: [ 400, 300 ],
        limit: [ 1 ]
      }
    }
    

    根据需要配置选项并查看原始 apostrophe-images-widgets/views/widget.html 以了解如何在架构模板中实现图像。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多