Proportional photos


You see, in a view I have this code:

<img class="card-img-top" style="width: 400px; height: 300px;" src="{{url($foto->ruta())}}"/>

This code causes an image to be shown on the screen, and this image will be modified to 400 pixels wide and 300 pixels high. I want my image to be 300 pixels high, but the width is proportional to the original width.

If the photo was originally 800x600, when it was shown to be 400x300, and if it was 100x150, it would be shown on the screen as 200x300. How do I do it?

asked by Miguel Alparez 08.11.2018 в 08:47

1 answer


Auto test

<img class="card-img-top" style="width: auto; height: 300px;" src="{{url($foto->ruta())}}"/>
answered by 08.11.2018 / 09:55