I have a WP slider with costum img sizes (fixed width and height) and i need that they would scale to fixed 330px height, and auto width. how to achieve this?
thank you in advance!
Adjust image sizes in the Settings > Media screen Here you can change width and height for the thumbnail, medium, and large image sizes. WordPress will then automatically create scaled versions of each image using these sizes. You can choose which size you want to insert from the WordPress editor.
The height and width of an image can be set using height and width attribute. The height and width can be set in terms of pixels. The <img> height attribute is used to set the height of the image in pixels. The <img> width attribute is used to set the width of the image in pixels.
Click the Edit Image button at the bottom of the photo. You will be directed to the Image Preview page. You'll see a few options on the right side of the page to either scale the image or crop it. You'll see the photo's original dimensions and a field where you can type in its new dimensions.
As this was specific wordpress question and I found an answed, i will share it. When you add custom image size to functions.php, add 9999 to width and hardCrop to false.
add_image_size('slider-thumb-alt', 9999, YOUR_FIXED_HEIGT, false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With