symfonywatermarkliipimaginebundle

symfony liip imagine watermark not working


So i tried to make watermark filter following the documentation https://symfony.com/doc/2.0/bundles/LiipImagineBundle/filters/general.html#watermark but it just does not work for me. I tried every combination of path to watermark image, but nothing worked.. what do I miss here?

I tried absolute path, relative to project dir, relative to public dir, with and without first slash / .... nothing happend...

this is my liip_imagine.yaml file

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 ]

Problem is that imagine is not giving me any error messages, just some random path to image that is not working and its not in filesystem

edit: actual watermark image is on public/img/watermark.png


Solution

  • The docs say something about the value for image path.

    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% is the path containing AppKernel.php.

    Knowing this, the path to the image will be

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