I am trying to render an image in a Twig template like this:
<img src="{{ asset('bundles/mybundle/images/no-image.png') }}" alt="no image available" />
It is being rendered like this (with a leading slash):
<img src="/bundles/mybundle/images/no-image.png" alt="no image available" />
which causes the server to look for an image in http://myserver.com/bundles/mybundle/images/no-image.png
The problem is when I am viewing the page in dev mode, it doesn't generate the correct asset url. What it should be is:
<img src="bundles/mybundle/images/no-image.png" alt="no image available" />
which would cause the server to look in the correct location:
http://myserver.com/app_dev.php/bundles/mybundle/images/no-image.png
Is there some way around this issue? I want the images in dev mode to run through app_dev.php