ux
ux copied to clipboard
[LazyImage] data_uri_thumbnail filename
In the documentation we can see a snippet of code, that explain how to use data_uri_thumbnail
, but this one is wrong, because internally the https://github.com/symfony/ux-lazy-image/blob/main/BlurHash/BlurHash.php use the file_get_content function that is relative to this file.
That's why in Twig we need to write the full path, that is not convenient.
<img
src="{{ data_uri_thumbnail('public/image/large.png', 100, 75) }}"
{{ stimulus_controller('symfony/ux-lazy-image/lazy-image') }}
data-hd-src="{{ asset('image/large.png') }}"
{# Using BlurHash, the size is required #}
width="200"
height="150"
/>
For this case, there is 2 option:
- We can do on our side, create a Twig global like below, and use it in Twig, maybe update the doc in this case
globals:
projectDir: '%kernel.project_dir%'
- Use the Project dir at start point to find the file
- I just miss something ?
I also experienced the same error. I think this has to be done internally so using it with asset()
would be easier
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?