Articles of add image size

custom thumbnail image size not working

I added below code in theme’s function.php add_theme_support( ‘post-thumbnails’ ); add_image_size( ‘thumb-small’, 200, 150, true ); and <?php the_post_thumbnail(‘thumb-small’); ?> this in theme’s file. I tried this also in function.php function add_custom_sizes() { add_image_size( ‘idea-thumb’, 146, 141, true ); } add_action(‘after_setup_theme’,’add_custom_sizes’); <?php the_post_thumbnail(‘idea-thumb’); ?> this in theme’s file. the_post_thumbnail( array(100, 100) ); // Other resolutions […]

Specify automatically the height and weight of the images

I just did a GTmetrix test for my website to check how it’s going, and I noticed that I have many images without height & width size specified. So I start thinking about a WordPress function that get the height and width of the current image and echo it. I found it but didn’t work […]

How risize a thumbnail?

I have a wordpress thumbnail, but i when set the size this (500,200) wordpress resize the imagen and let it square, only 500×500. I set in functions.php add_image_size (‘single_post’,500,200) In the theme if(has_post_thumbnail()) { the_post_thumbnail(‘single_post’); } Can anyone help me please?

Why isn't add_image_size('event-secondary-image-thumbnail', 250, 150) working?

I am using a plugin called multi post thumbnails so that I can have more than one featured images for each post. I have a custom post type called event. The class multiPostThumbnails exists . it displays the images, it just doesn’t restrict them to 250 by 150 pixels. How can I make this work, […]

Overwrite add_image_size defined by theme

I bought a WP-Theme which defines a custom image-size in his theme-functions.php like this: if ( function_exists( ‘add_image_size’ ) ){ add_image_size( ‘tie-small’, 70, 70, true ); } As you can see the third-parameter is true, which results in hard crop mode (see WordPress Documentation for add_image_size). This mode isn’t taking care of the proportions so […]

Why does the Hard Crop option Scale?

I have a number of custom image sizes. I noticed earlier, when I was publishing a new post, that the post image was cropped AND scaled. It is exactly the right dimensions.. but it isn’t the portion of the image it should be. This is the code in functions.php, for this particular image size. add_image_size( […]

Function to insert missing image size attributes into img tags

I want to add a custom function to scan my website and automatically insert image size attributes that are missing on my pages. For example, if there is an image on one of my pages that looks like the following: <img src=”” alt=”Image Title”> If img.jpg actual size is 150×50 px, the function would pick […]

One of my image sizes isn't showing up in srcset

So for I’ve added some custom image sizes like this: add_action(‘after_setup_theme’, ‘image_sizes_setup’); function image_sizes_setup(){ add_theme_support( ‘post-thumbnails’ ); add_image_size(‘thumb-small-2x’, 196, 9999); add_image_size(‘thumb-medium-2x’, 276, 9999); add_image_size(‘portrait-thumb-large-2x’, 328, 9999); add_image_size(‘landscape-thumb-large-2x’, 9999, 328); add_image_size(‘small-2x’, 900, 600); add_image_size(‘medium-2x’, 1200, 800); add_image_size(‘large’, 1920, 1280); add_image_size(‘large-large-2x’, 2160, 1440); add_image_size(‘extra-large-2x’, 2400, 1600); } Then I wrote this code so I can select them […]

How to add a new image size and apply it to posts only?

I’d like to create a new image size and write another function that basically says that if I’m applying this new image to any posts to use this new image size. function add_image_size( ‘story_thumb’, 640, 640, array( ‘center’, ‘center’ ) ); Is the function I have for the new image size. I want it to […]

JointWP – Can't add custom images sizes

I am trying to add a custom image size in the functions.php file. add_image_size( ‘Portrait’, 1200, 1800, false ); add_image_size( ‘Featured’, 2560, 1600, true ); This is the newest version with foundation 6. Am I putting it in the wrong file? Thanks for any help.