Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resize wordpress image to fixed height and auto width

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!

like image 415
Rokas Avatar asked Aug 06 '13 18:08

Rokas


People also ask

How do I automatically resize images in WordPress?

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.

How do you fix the width and height of an image?

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.

How do I scale an image in WordPress?

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.


1 Answers

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);
like image 126
Rokas Avatar answered Sep 20 '22 13:09

Rokas