Uploaded images are smaller

Hello again :slight_smile:

I have encounterd a problem in which whatever image i upload to the media the height of that img becomes 750px and the width stays in 500 - 590pm!

the image is not fitting the featured image area any more and the problem is that the original image is getting resized to the dimension.

so here is an image which has 1600px in width and after importing it it gets like this! i have used regen thubnail plugin and no use.

Dimensions: 560 Ă— 750

my media setting r default

small - 150

medium - 300

Large - 1024

thanks in advanced

Featured images are cropped to 750 by 410 and it is defined via functions.php file like this:

add_image_size( 'sparkling-featured', 750, 410, true );

Which means that featured images will always be the same for consistency. But this does not affect any other images inside post content and they are not cropped or resized unless you choose “small”, “medium”, “large” options when adding them inside posts but these sizes are not controlled by theme.

If you want your images to not be cropped for featured images you should increase height for features images to some large number. Something like this would do the trick:

add_image_size( 'sparkling-featured', 750, 9999, true );

Don’t change width for images because content area is always 750px wide, so it make no sense to make them wider.

Once you change values in functions.php you will have to regenerate thumbnails again.

thanks a lot

i have figured out the the images that i have vertically were the ones that getting smaller. it was because of the aspect ratio which wants to make the image 750px in height and reduces the width accordingly. and because the images height is much more than width the width was getting reduced to match the750px in height.

for those images i took them to Photoshop and cropped them manually to 750 * 750 and they worked fine.

I’ll try your way so i don’t have to do those stuff manually anymore.

but each time i try to add anything in the functions.php in my child theme the entire site disappears after saving.

can you please tell me what exactly i should add in the empty functions.php file in my child theme

If your Child Theme functions.php file is completely empty you can use this code to set featured image size to 750px by 750px:

<?php 

function child_theme_setup() {
	add_image_size( 'sparkling-featured', 750, 750, true );
}
add_action( 'after_setup_theme', 'child_theme_setup', 11 );

?>

When your page turns blank it means that you have made some error in your code that breaks everything. It is easy to break thing since it can return fatal error even if you have forgot semicolon or something else that might look insignificant.

thanks alot :))