# Images in Plugin with Twig-View or PHP-View

**URL:** <https://forum.mautic.org/t/images-in-plugin-with-twig-view-or-php-view/32393>\
**Category:** Development\
**Tags:** development\
**Created:** [June 16, 2024, 6:14am UTC](https://forum.mautic.org/t/images-in-plugin-with-twig-view-or-php-view/32393 "2024-06-16T06:14:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcdiver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mcdiver/32/6618_2.png) [@mcdiver](https://forum.mautic.org/u/mcdiver)\
**Post date:** [June 16, 2024, 6:15am UTC](https://forum.mautic.org/t/images-in-plugin-with-twig-view-or-php-view/32393/1 "2024-06-16T06:15:00Z")

</div>

Hello guys,  
I am a beginner in Mautic plugin development. Currently, I try to create a simple plugin, which adds a menu item and display a view.  
It is working fine but I came across a ambiguity with twig and php view templates.  
I try to show a view in Mautic with an images. I put the image in the Asset/images directory of the plugin. Now I see, that I have two posibilities to create a view:

- myView.html.php
- myView.html.twig

As I see in the other Mautic files, everyone uses twig. But I have no clue how to show an image in a twig template because the url for the image is never correct, no matter what I tried. Hence I tried with the myView.html.php:

If I read the documentation, the $view variable is available in myView.html.php from which I would get the image path and url.

```auto
echo '<img src="' . $view['assets']->getUrl('plugins/HelloWorldBundle/assets/images/earth.png') . '" />';

```

Unfortunately, if i try to use php-views, it simply does not show anything if I call myView.html.php from the delegateView-Method and if I try a twig template I do net get the correct path (url) for the image.

Can someone explain or just give me the code for displaying an image in a twig template?

---

<div class="post-metadata">

**Author:** ![kuzmanyy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/kuzmanyy/32/390_2.png) [@kuzmanyy](https://forum.mautic.org/u/kuzmanyy)\
**Post date:** [June 17, 2024, 11:12am UTC](https://forum.mautic.org/t/images-in-plugin-with-twig-view-or-php-view/32393/2 "2024-06-17T11:12:26Z")

</div>

It’s Mautic4?
