0

I'm using LiipImagineBundle and AWS SDK in one project. Everything works fine, but now I want to create a watermark filter. In the Liip doc, they say we must inform in the configuration what the path of the watermark image is.

My problem is that this path is dynamic as it can change from one image to another. And it is also stored in S3.

In an older version of Liip, I had extended the ImagineController to added some logic. However, the bundle has completely changed and what I used to do don't work anymore.

I also saw a solution on github where the developer was adding a configuration to the filter in twig. I tried it but it didn't work:

{% set runtimeConfig = {"watermark": {"size": 1, "image": 'http://' ~ amazon_s3_media_url ~ '/establishment/' ~ establishment.watermarkPath, "position": 'bottom' }} %}
{% set url_photo_medium = photo.imagepath | imagine_filter('photo_high', runtimeConfig) %} 
<img src="{{ url_photo_medium }}" alt="">

I'm not sure this would be a great solution even if it works because it is not dynamic. Does anybody know what the best solution for this problem is?

Thanks!

ana-lu
  • 269
  • 1
  • 3
  • 12

1 Answers1

0

After searching on Github and other sites, I learned that it's not yet possible to use an image stored on S3 as watermark. The reason is that the filter watermark doesn't accept an URL as image path. So the solution is to store the watermark image on the local filesystem.

Moreover, for the dynamic filter, there's a runTimeConfig that can be used directly on Twig:

{% set runtimeConfig = {"thumbnail": {"size": [50, 50] }} %}
<img src="{{ '/relative/path/to/image.jpg' | imagine_filter('my_thumb', runtimeConfig) }}" />
ana-lu
  • 269
  • 1
  • 3
  • 12