I want to add Thumbnail-Settings for my theme. I'm using the default theme for the moment.
There is already a image-formats.xml in the themes config.
<?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>
The corresponding config looks like that:
# LIIP Theme Configuration
liip_theme:
themes: ["default"]
active_theme: "default"
load_controllers: false
If i dump the images in my assets the new format (the 1200x) is not shown. I tried to reload the config and clear the cache. I also cleared the web/uploads/media folder.
What else can it be?
Here is the dump of the image in the template. As you see, my own format is not appearing.
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: "[]"
}
}
Image Formats are stored in the container by compiler pass in the sulu_media.image.formats
parameter. When you add a new image format a cache delete for BOTH Kernels is needed.
app/console cache:clear -e yourenvironment
app/webconsole cache:clear -e yourenvironment