symfony liip想象水印不起作用

symfony liip imagine watermark not working

所以我尝试按照文档制作水印过滤器 https://symfony.com/doc/2.0/bundles/LiipImagineBundle/filters/general.html#watermark 但它对我不起作用。我尝试了水印图像路径的所有组合,但没有任何效果。我在这里想念什么?

我尝试了绝对路径,相对于项目目录,相对于 public 目录,有和没有第一个斜杠 / ....没有发生...

这是我的 liip_imagine.yaml 文件

liip_imagine:
  # valid drivers options include "gd" or "gmagick" or "imagick"
    driver: "gd"

    loaders:
      default:
        filesystem:
          data_root: "%kernel.project_dir%/public"

    resolvers:
      default:
        web_path:
          web_root: "%kernel.project_dir%/public"
          cache_prefix: "/content/cache"

    cache: default
    data_loader: default

    filter_sets:  
      cache: ~

      gallery:
        cache: default
        data_loader: default
        jpeg_quality: 85
        png_compression_level: 8
        filters:
          watermark:
            image: "/img/watermark.png"
            size: 0.5
            position: center
          auto_rotate: ~
          strip: ~
          scale:
            dim: [ 900, 750 ]

问题是 imagine 没有给我任何错误消息,只是一些随机的图像路径不起作用并且它不在文件系统中

编辑:实际水印图像在 public/img/watermark.png

文档说明了 image 路径的值。

https://symfony.com/doc/2.0/bundles/LiipImagineBundle/filters/general.html#watermark-options

image: string Sets the location of the watermark image. The value of this option is prepended with the resolved value of the %kernel.root_dir% parameter.

%kernel.root_dir%是包含AppKernel.php.

的路径

知道这一点,图像的路径将是

image: "/../public/img/watermark.png"