The answer is to not generate more image dimensions (and your theme overriding user settings is a big no no), but to select the best fitting image bt size and apply css based stretching and cropping by wrapping the img element with a span.
The to the img you use whatever is the best fit, and then by using a combination of relative positioning in the span and changing the image size you can get whatever effect you want.
This is really just a “view port” technique that is as old as CSS, the only wordpress specific part is to pass to the sizes that you want to the_post_thumbnail as the first parameter.
The gotcha with this is that obviously if wordpress gives you a cropped image you can’t “uncrop” it, and you will have to add your own image size setting for that.
Related Posts:
- Original image not saving?
- No Thumbnails Generated
- Which filters or actions to use after a media upload and delete?
- Convert uploaded PNG to JPEG automatically
- add_image_size creating lots of images (of various sizes)
- WordPress won’t generate image sizes for certain images
- Thumbnails produce unwanted gray pixels on white background [closed]
- Site icons with alpha channel for self-hosted WordPress blog network
- Can I stop wordpress generating media sizes
- add_image_size() and uploading the exact size leaves 1×1 image in uploads
- Attach Thumbnail Generated from Video Upload as Featured Image for the Video
- WordPress Media Library showing wrong preview size?
- Redirect to another page using contact form 7? [closed]
- Resize existing library images
- Issue with images which have no sizes available
- What is the URL pattern for image thumbnails + sizes?
- Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio
- Removing extra large generated images disables all crops
- Images uploaded via Gutenberg image block are cropped
- get the post thumbnail returns the full size
- Is there a way to force Featured image to show as attachement?
- Question regarding the file path for media_sideload_image and wp_upload_dir()
- How does WP media uploader create the 3 different sized images, and how can I duplicate it
- Upload images to remote server
- Create image formats with different qualities when uploading
- Protecting direct access to PDF and ZIP unless user logged in (without plugin)
- How to restrict images in v3.5 Media Library modal to only those from a specific post id?
- Where do the favicons for Media Files come from
- How to register images uploaded via FTP in media library?
- How can I speed up a slow loading media library?
- Impose a Maximum Limit on Image height and width upload size
- Force wordpress to see uploads folder media
- Restrict file uploads by extension?
- resize images not crop
- How to upload imagick resource to media in wordpress
- Upload image from a URL and assign it as a Featured Image to a Custom Post Type?
- Plugin to Import Dropbox Files into Media Folder from the Cloud [closed]
- Uploading images to Media Library fails with Memory Exhausted
- Edit image preview is not displayed
- Media library not loading after switching the main site of multisite
- Different upload path per file type
- Resize the WP media Uploader iFrame
- Cannot upload .mp3 file to wordpress media
- Custom “Insert into Post” button
- How to use MediaUpload outside of editor
- Switch between tabs on “Insert Media” dialog
- Bulk edit of EXIF data for jpeg images uploaded in the media library?
- Image Uploader API
- Prevent a folder from being shown within the media library
- Is It Possible to Upload Certain Attachment Files To A Remote Server
- Error uploading image in WordPress
- WordPress Issue : The uploaded file could not be moved to wp-content/uploads/
- wordpress media upload given An error occurred in the upload. Please try again later
- After moving from complete AWS setup to a standalone WordPress Server, Media/Image Files are Broken
- Using wp_enqueue_media() with switch_to_blog() issue
- Duplicates and other problems in Media Library
- WordPress Media frame pre load images from ids
- Can’t generate thumbnail images
- Choosing images size when uploading
- Restrict role to view own media
- Image resizing – TimThumb vs convert on upload?
- upload_max_filesize is set to 64 MB already but WordPress is still showing 2 MB
- How to set uploaded image as featured image wordpress
- Stop image resizing in particular case – is that possible?
- WordPress media upload issue could not insert attachment into the database
- Thumbnail images missing in WP media library
- Get featured image with custom size outside WordPress
- get_attached_file returns wrong path after changing media upload dir
- How to change the value “uploaded to” in the media library (WordPress 4.0)
- Remove Media File Items From Server That Do Not Exist in Media Library
- How to Make Thumbnail of Post Stay Animated
- Cropping thumbnails to specific dimensions on front end post
- What if I have a large file on the server that I want the wp library to have?
- Custom image sizes showing in Classic Editor only when upladed directly to post
- Make inline uploader (plupload) on options page upload to a specific folder
- An error has occurred during the upload process in wordpress version 5.3.2
- Media Library: Remove replace images of selected author
- What is wrong with my wp_insert_attachment code?
- Editor User Role can’t see other users media
- How to upload multiple images using WP rest API to media?
- How to handle a lot of media files in the uploads folder? (+10.000)
- Import all media referenced in posts
- Organizing the Media Library for Cleanup
- Allow author to upload image via Media button without plugin
- Insert media while posting is not working with new wordpress update
- Exclude some photos in media library
- Failed to load resource at admin screen
- WordPress Image Resize fails without Error Message
- Media uploader & manager: add/remove class on image with checkbox
- Image uploaded in media library, can only see it when I using the WP Edit Image feature. 404 when trying to view in browser
- Host Images from Link
- How do I change a Themes Header Image?
- Add frontend editor with media buttons for Visitors and display only their media
- Media Library is not loading on grid view in admin panel
- Blurry Images WordPress 5.8.1
- How do I restore attachment from files in wp-upload
- Image in binary in the data to WordPress media library
- Different upload file size limits based on file type
- How do I display a PDF thumbnail as a link to the PDF without uploading the image
- Featured Image add tab