0

I'm Facing Weird issue with svg files and twig

It says Fatal error: Uncaught Twig\Error\LoaderError: Unable to find template

{% set logo = Image(options.logo_foot) %}               
    {% if logo.file_loc %}  
        {{ source(logo.file_loc) }}  
    {% endif %}
            

seems more likely to windows issue on mac everythings works fine

DarkBee
  • 16,592
  • 6
  • 46
  • 58
Dpk
  • 567
  • 5
  • 16
  • Any reason why you are using the function `source` here? This is usually used to display the source of a template located in a registered views folder. What is your expected output? - [documentation](https://twig.symfony.com/doc/3.x/functions/source.html) – DarkBee Mar 02 '22 at 13:54
  • Yes Basically it will get the svg file from upload folder on mac same code works but on windows not working – Dpk Mar 02 '22 at 14:10
  • What do you mean with "On mac it is working". Twig is rendered server-side. Are you testing this on two different servers? – DarkBee Mar 02 '22 at 14:12
  • i'm using local by flywheel live server its fine – Dpk Mar 02 '22 at 14:15
  • nah everything is on my local machine – Dpk Mar 02 '22 at 14:18
  • it returns the path of the svg file but the error message says it cant find that file although the file is present – Dpk Mar 02 '22 at 14:20
  • As I said, `source` expects the file to be inside the `Views` folder. Is this the case? – DarkBee Mar 02 '22 at 14:28
  • No as this return the path for the svg file inside brackets --> {{ source(directory ~ '/src/images/icons/hex.svg') }} then it get file from upload folder and it display on the page – Dpk Mar 02 '22 at 14:38
  • Does this answer your question? [Do I use , , or for SVG files?](https://stackoverflow.com/questions/4476526/do-i-use-img-object-or-embed-for-svg-files) – DarkBee Mar 02 '22 at 14:40

0 Answers0