Sanjay Rathod
Sanjay Rathod

Reputation: 1143

How to create thumbnails of the same size?

Please check here, how to set dimension of feature images uploaded in post and page?

See below image for what I actually want

enter image description here

Upvotes: 2

Views: 7888

Answers (6)

Vaibs_Cool
Vaibs_Cool

Reputation: 6156

Use add_image_size() in your functions.php:

<?php add_image_size( $name, $width, $height, $crop ); ?>


add_image_size( 'your-image', 150);

...and then use this in your template:

<?php the_post_thumbnail('your-image'); ?>

REFERENCE : http://codex.wordpress.org/Function_Reference/add_image_size

Some changes in your website css

Try adding height:250px; //example you can whatever you want. ...

in your

.avia-content-slider .slide-image, .avia-content-slider .slide-image img  

I have a screenshot for you

enter image description here

and have a look ..

Upvotes: 6

Chandresh M
Chandresh M

Reputation: 3828

Please add below code in theme's function.php file

if ( function_exists( 'add_image_size' ) ) { 
add_image_size( 'custom-image-thumb', 200, 200,true ); //200 pixels wide and 200 height, true for crop exact size and false for dimensional crop.
}

Then you can use this on front side like below code :

<?php echo $image = get_the_post_thumbnail($post_id, 'custom-image-thumb'); ?>

Upvotes: 5

Hasan Gad
Hasan Gad

Reputation: 33

/////// Adding custom feature image size //////////////////

add_image_size( $new_size_name, $width, $height, $crop);

USAGE :

let's say that you need width = 100 and height = 300

insert next code at your theme functions.php file

add_image_size( "test_size", 100, 300, true );

Use next code at any place you want :

<? echo get_the_post_thumbnail($post_id, 'test_size'); ?>

NOTICE : *if you test it and nothing happen .. you just need to remove the feature image and uplaod it again with another name .

NOTICE : $crop = False - Soft proportional crop mode ; True - Hard crop mode.

// reference :http://codex.wordpress.org/Function_Reference/add_image_size

// reference :add_image_size( $name, $width, $height, $crop );

Upvotes: 2

Nizam Kazi
Nizam Kazi

Reputation: 1920

You should always search in WordPress Codex for that first!

See if this article helps you: "https://codex.wordpress.org/Post_Thumbnails#Thumbnail_Sizes"

Upvotes: 1

brasofilo
brasofilo

Reputation: 26055

After changing/adding image sizes, as described in Vaibs_Cool's answer, you need to rebuild your previous thumbnails as old ones are not affected, only newly uploaded files.

The classic plugin used for this is

Regenerate Thumbnails

Allows you to regenerate the thumbnails for your image attachments. This is very handy if you've changed any of your thumbnail dimensions (via Settings -> Media) after previously uploading images or have changed to a theme with different featured post image dimensions.

There's another plugin always cited, but I've never used as RT works well.

Check the following search results in WordPress Answers regarding both plugins, this will lead to interesting discussions about the topic: [ 1 ] and [ 2 ].

Upvotes: 4

Meet M Vyas
Meet M Vyas

Reputation: 11

you just add the some css code.for particular that thumbnail images. like this ,

.slide-entry a img {hight:248px; width:248px;}

in your style.css.

Upvotes: 1

Related Questions