无法识别主题的图像格式

Image formats of theme not recognized

我想为我的主题添加缩略图设置。 我暂时使用默认主题。

主题配置中已经有图片-formats.xml。

<?xml version="1.0" encoding="UTF-8"?>
<formats xmlns="http://schemas.sulu.io/media/formats"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://schemas.sulu.io/media/formats http://schemas.sulu.io/media/formats-1.0.xsd">
    <format>
        <name>640x480</name>
        <commands>
            <command>
                <action>resize</action>
                <parameters>
                    <parameter name="x">640</parameter>
                    <parameter name="y">480</parameter>
                </parameters>
            </command>
        </commands>
    </format>
    <format>
        <name>1200x</name>
        <commands>
            <command>
                <action>scale</action>
                <parameters>
                    <parameter name="x">1200</parameter>
                </parameters>
            </command>
        </commands>
    </format>
</formats>

相应的配置如下所示:

# LIIP Theme Configuration
liip_theme:
    themes: ["default"]
    active_theme: "default"
    load_controllers: false

如果我将图像转储到资产中,则不会显示新格式 (1200x)。 我试图重新加载配置并清除缓存。我还清除了 web/uploads/media 文件夹。

还能是什么?

这是模板中图像的转储。 如您所见,我自己的格式没有出现。

Media {#2167 ▼
  #url: "/media/12/download/1.png?v=1"
  #formats: array:10 [▼
    "400x400" => "/uploads/media/400x400/02/12-1.png?v=1"
    "400x400-inset" => "/uploads/media/400x400-inset/02/12-1.png?v=1"
    "200x200" => "/uploads/media/200x200/02/12-1.png?v=1"
    "190x" => "/uploads/media/190x/02/12-1.png?v=1"
    "170x170" => "/uploads/media/170x170/02/12-1.png?v=1"
    "150x100" => "/uploads/media/150x100/02/12-1.png?v=1"
    "100x100" => "/uploads/media/100x100/02/12-1.png?v=1"
    "100x100-inset" => "/uploads/media/100x100-inset/02/12-1.png?v=1"
    "50x50" => "/uploads/media/50x50/02/12-1.png?v=1"
    "640x480" => "/uploads/media/640x480/02/12-1.png?v=1"
  ]
  #locale: "de"
  #version: null
  #additionalVersionData: array:1 [▶]
  #fileVersion: FileVersion {#2754 ▶}
  #file: File {#2751 ▶}
  #entity: Media {#2748 ▶}
}
FileVersionMeta {#2759 ▼
  -id: 12
  -title: "1"
  -description: null
  -copyright: null
  -locale: "de"
  -fileVersion: FileVersion {#2754 ▼
    -name: "1.png"
    -version: 1
    -size: 105564
    -mimeType: "image/png"
    -storageOptions: "{"segment":"04","fileName":"1.png"}"
    -storageType: null
    -downloadCounter: 0
    -created: DateTime {#2742 ▶}
    -changed: DateTime {#2743 ▶}
    -id: 12
    -contentLanguages: PersistentCollection {#2761 ▶}
    -publishLanguages: PersistentCollection {#2763 ▶}
    -meta: PersistentCollection {#2758 ▶}
    -file: File {#2751 ▶}
    -tags: PersistentCollection {#2756 ▶}
    -changer: User {#2430 ▶ …2}
    -creator: User {#2430 ▶ …2}
    -defaultMeta: FileVersionMeta {#2759}
    -properties: "[]"
  }
}

似乎存在缓存问题。我已经删除了 cache-folder,但没有用。我重新启动了我的虚拟机,现在它可以工作了。对我来说似乎是个问题 :-)

图像格式由编译器传入 sulu_media.image.formats 参数存储在容器中。当您添加新的图像格式时,需要删除两个内核的缓存。

app/console cache:clear -e yourenvironment
app/webconsole cache:clear -e yourenvironment