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 to Fix HTTP Error When Uploading Images?
- Trigger refresh for new media manager in 3.5
- Physical organization of wordpress media library (Real Media Library plugin)
- How to generate thumbnails when needed only?
- How to Require a Minimum Image Dimension for Uploading?
- Images not aligning correctly
- Troubles with code for upload a image
- Organizing the Media Library for Cleanup
- Allow author to upload image via Media button without plugin
- Featured image to grayscale with PHP imagefilter – which hook to use?
- Issues with WordPress 3.9.6 media libraries on XAMPP
- Insert media while posting is not working with new wordpress update
- How to configure WordPress to create thumbnails
- My deleted media exists jet
- Exclude some photos in media library
- Upload Multiple Files With Multiple Fields And With media_handle_upload
- Failed to load resource at admin screen
- Private file system for attachments
- controlling whether upload is attached to post or not
- How to split my uploaded media into directories?
- Assign one featured image to multiple posts?
- Missing Images in Uploads Directory (Server Only)
- Metabox with file upload to custom directory
- WordPress Image Resize fails without Error Message
- How to force attachment size for every post
- Attachment Metadata not updated while uploading audio files
- Is it possible to upload multiple images via Media Library tab in Thickbox I’ve created?
- Make thumbnail from uploaded image without plugin
- Set featured link not showing
- Media uploader & manager: add/remove class on image with checkbox
- wordpress 3.6 media manager cropping timestamp
- Broken Media Library
- Transfered live site to new server and images are not showing
- Limit files uploaded per folder
- Link or button to open the media manager from frontend
- Problem uploading files, after changing domain name
- Image uploaded in media library, can only see it when I using the WP Edit Image feature. 404 when trying to view in browser
- Automatically adding images to a certain page through the Media Uploader
- Host Images from Link
- My image rotate 90 degree
- 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
- How to modify Media Library images DPI [ image quality down to make small in size ] [closed]
- Blurry Images WordPress 5.8.1
- Unable to upload images using the Media Library
- Bring up the media uploader on click
- Retroactively change Permalinks for media files after disabling year/month format
- Why some images are not allowed to be edited only for thumbnails?
- My subdirectory sites images (except webP) are throwing to 404 page even they are exist
- How can comments be turned off for media attachments on WordPress?
- Generate and upload screenshot as featured image for user-submitted post
- What does WordPress media uploader do to image files on upload?
- How can I use an image from an external source without uploading it to the media library
- Upload to a specific media folder created by FileBird Lite
- How do I restore attachment from files in wp-upload
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)
- Assign multiple categories to Media Library upload
- Is there a way to upscale a media library original image to the nearest whole pixel in WordPress?
- Image in binary in the data to WordPress media library
- How can I add custom sizes for PDF thumbnails generation?
- Media manager asks for file title when upload
- Simplifying ‘Add Media’ Modal in front-end Content Editor
- How to Upload a media item with alt text and description
- Trying WP editor to load full size image (not ‘300×300’)
- Cannot Upload Video (MP4) File
- “Media Library” shows as empty, despite images being present
- Different upload file size limits based on file type
- How to change media folder from created time of the post to publish date?
- How to upload multiple images to use as gallery in Kirki Framework
- Adding multiple MIME types of the same extension to WordPress?
- Restricting Image Upload Sizes using ‘wp_handle_upload_prefilter’ – Stuck media progress bar when Featured Image?
- Add URL in image upload error message
- How do I display a PDF thumbnail as a link to the PDF without uploading the image
- I can’t see all images in my media library – How Can I reset the index of that library?
- WordPress Permissions Issue for Media Library / uploading
- Convert base64 string to WordPress attachment uploads multiple images instead of a single one
- Featured Image add tab