There are multiple solutions:
-
Use CSS for post images:
.post img { height: 300px; width: auto; }
-
Use a custom thumbnail size. Either in Settings -> Media or use a third-party plugin to generate them. Another way would be to code your own:
function custom_image_sizes() {
add_theme_support('post-thumbnails');
add_image_size('breaking-news', 9999, 300, true);
}
function add_custom_sizes( $imageSizes ) {
$my_sizes = array(
'breaking-news' => 'My breaking news image'
);
return array_merge( $imageSizes, $my_sizes );
}
add_action('after_setup_theme', 'custom_image_sizes');
add_filter( 'image_size_names_choose', 'add_custom_sizes' );
Related Posts:
- Ho to add “Create Slider” option to default “Add Media” popup?
- Restricting users to view only media library items they have uploaded?
- Prevent WordPress from generating medium_large 768px size of image uploads?
- Upload images to remote server
- Set default image link target in Gutenberg image block
- How to have different captions for same image, for galleries?
- Featured image shortcode
- Using Images in WordPress – Best Practices
- Media Upload Folder – how to manage
- How to set the default embed image size
- Always use for post images
- Filter Media Library by author or post_parent
- Use Media Library to manage galleries like Nextgen (with folders, albums, collections, tags, categories, terms…)
- How do i upload an image and return the image id?
- Alter media caption/description conflict in WordPress?
- Restrict the number of images to upload per post
- How can I make all gallery images to open in a new window?
- How to display a shortcode caption somewhere other than the_content
- Upload images using FTP and show them in media
- Media sizes aren’t being created – server config?
- Add visual editor to Media Edit Screen
- custom image size with New Media Manager in wordpress 3.5
- How to store media files in subdomain
- get attributes/part of the gallery shortcode
- How to add a media with PHP
- How do i reference the theme path in pages for images?
- How to make programmatic image upload generate thumbnail and sizes?
- Can’t access ‘Store uploads in this folder’
- Editing built in Gallery shortcode to filter by categories
- How to add qtranslate multi language support for media?
- Best way to strip character entities (%20 etc)
- What’s the best “insert all images” plugin?
- Different upload path per file type
- 3.5 media.editor: what is the event listener for choosing an image?
- Getting alt text of featured image
- Get image alt attribute just by image URL
- Is there a way to get attachment data?
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- Rename media files generated during upload
- Thumbnails are bigger in size than the original image
- Link to full size image or attachment page in photo theme
- HTTP Error when uploading files above 7mb unless using GD Image Editor
- Add attribute to caption shortcode from custom attachment field
- Get an image’s alt text in a shortcode using the image URL
- How Do I Delete All The Images from WordPress
- Shortcode for a link and thumbnail
- Is my code is right to make image shortcode
- Change WordPress Media Manager
- Set Post Image Using Shortcode
- Site migration – some images not displaying in Media Library
- Bulk edit of EXIF data for jpeg images uploaded in the media library?
- Upload media files to Amazon S3
- image in my post disappeared after I upload website to remote server
- Handling image uploads without thickbox
- Turn off image captions in gallery view?
- Pull images from the gallery
- How can I create more upload paths, like a post corresponding to a post title folder used to store images of the same product
- WordPress automatically downscaled images larger that original
- How to open default wp image editor screen dynamically?
- How to change image atributes right before an image to be saved?
- Is it possible to change ‘Link to’ in all images in all articles?
- add media button is not working
- Undefined index: sui_image_caption in [closed]
- add_shortcode to capture URL screenshot not loading correctly
- Searching for any images in media library displays “no media found”
- How to filter the image embed code based on link type
- Why it doesn’t show media urls on rest Api? (WordPress)
- How to get file URL from media library
- Edit image results in copies of file being created
- Images uploaded to the media library has strange colors. However, in the edit screen the color is ok
- Change wp-content/uploads to uploads/%postname%/%image%
- Blank upload.php page
- Post and featured image have the same name, why is the attachment (image) is showing and not the post?
- Export xml use/import images from theme directory
- Upload box media size not working
- Don’t show images inserted into content
- Is it possible to change image size used for preview thumnail in Add Media popup
- Moving media library to the media library of completely different site
- Why does WP allow to view and media item as a page
- Upload media only to DB
- Random image loader
- Load Gallery Images with Title on Homepage BX Slider
- Function to remove all classes on images inserted into posts?
- Get images attached to a specific page
- Weird failing request
- Why WordPress suddenly changed sizes of thumbnails?
- Is there a way in WordPress to convert images to WebP without a plugin?
- Automatically Insert alt attribute above image has h2
- Auto delete pictures in media library by age
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- WordPress Attachments with old images
- Weird encoded error when using wp_generate_attachment_metadata()
- Prevent WP from wrapping html in caption shortcode after ‘image_send_editor’ filter is applied
- Disable image rename on upload
- Image and shortcode not showing in excerpt
- Set Featured Image not opening – Stuck at loading
- How to remove “Image Information” and “post date/author” from a media page?
- How can i identify media uploaded to my website that is not being used anywhere anymore?
- image URL changed in wordpress
- Can’t seem to see images on my machine but can on the server