Use {{asset ()}} in an echo

3

I have the following problem:

I need to make a query of images saved on the server to show them in a view

 echo "<img src={{asset ('images/producto/{$producto->imagen}'}} title='{$producto->imagen}'/>";
    
asked by harriroot 05.10.2016 в 19:28
source

1 answer

3

What Blade does in this case is nothing more than a kind of echo, therefore it would be redundant what you are doing (echo within another echo), something like this should work:

<img src={{ asset('images/producto/' . $producto->imagen) }} title='{{ $producto->imagen }}' />

I assume you are in a blade view for which I use the PHP style in HTML (and not the other way around as you were doing).

    
answered by 05.10.2016 / 19:55
source