0
votes

I have a WordPress theme which (weirdly enough, it is what it is) requires featured images to be as big or larger than a particular size, which is usually bigger than my featured images.

How can I systematically resize all featured images to be larger (enlarge + crop) than they currently are, to be a specific size, say 700px x 300px?

I've tried ViperBond's regenerate thumbnails plugin by setting the thumbnail size larger, but this didn't work -

2
It all depends on the original size the image was uploaded at. If you uploaded image size is smaller than what you now need, nothing will help. Unfortunately wordpress can't upsize images. It can only create an additional image size up to the size of the original uploaded imagePieter Goosen

2 Answers

0
votes

At first you should register custom image size, for example:

<?php add_image_size('custom', 700, 300); ?> 

Second, you should generate url with custom sizes, for example:

<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'custom') ); ?>
<img src="<?php echo $url ?>" />

I didn't test it, but this should work.

0
votes

Are the images you uploaded large enough? If they say have a dimension of 500 x 200px it's impossible to display them with a 700 x 300px dimension without stretching.

If you have, you can set your image dimensions for new images through your media settings.

The existing images can be resized with a plugin like Regenerate Thumbnails.