Looking for a way to set a fixed height for a file input with preview? Check out this Codepen example:
In the HTML (vue component), there is a card element with an image that maintains its aspect ratio. However, you may want to fix the height of the component to 300px while keeping the right aspect ratio of the loaded image, filling any gaps with a grey background.
<div id="">
<div class="field-body row">
<div class="col-md-6">
<div class="card" style="height: 400px">
<div class="card-image">
<figure class="image imup-image" style="padding-top: 75%">
<img src="http://www.lagom.nl/lcd-test/img/gamma-test-2.png">
</figure>
</div>
<footer class="card-footer">
...
</footer>
</div>
</div>
</div>
</body>
The CSS includes styling for the figure, custom file label, buttons, and more to ensure the image remains centered and fits within the specified dimensions.
Feel free to test the component and see how it maintains the image's aspect ratio while also exploring options to force the height as desired.