Liip想像-调整大小-边框

时间:2019-01-09 20:34:57

标签: image symfony liipimaginebundle

在与Symfony 4.1一起使用liip_imagine软件包时遇到问题 一切正常,这是我的配置:

liip_imagine:
filter_sets:
    thumb: 
            quality: 75
            filters:
                    thumbnail:
                            size:   [360, 230]
                            mode: inset
                    background:
                            color: '#f8f9fa'
                            size: [370, 240]
                            position: center
    small:
            quality: 100
            filters:
                    thumbnail:
                            size: [400, 240]
                            mode: inset
                    background:
                            color: '#f8f9fa'
                            size: [410, 250]
                            position: center
    medium:
            quality: 100
            filters:
                    thumbnail:
                            size: [640, 400]
                            mode: inset
                    background:
                            color: '#f8f9fa'
                            size: [650, 410]
                            position: center
    large:
            quality: 100
            filters:
                    thumbnail:
                            size: [800, 600]
                            mode: inset
                    background:
                            color: '#f8f9fa'
                            size: [810, 610]
                            position: center

问题是图像正在缩放到所需的大小,但使用的似乎是背景并且没有填充此页面上所描述的帧: Link

有人可以告诉我这是怎么回事吗?

非常感谢。

1 个答案:

答案 0 :(得分:0)

All you need is to configure your backgroun settings, The default color is white (#fff), so all you need is to set a size depending on your image input:

# app/config/config.yml
liip_imagine:
    filter_sets:

        # name our filter set "my_background_filter"
        thumb:
            filters:
                quality: 100

                # use and setup the "background" filter
                background:

                    # set the background color to #00ffff
                    color: '#00ffff'

                    # set a size different from the input image
                    size: [1026, 684]

                    # center input image on the newly created background
                    position: center
相关问题