The answer to you question can be found here: https://stackoverflow.com/questions/10722466/how-do-i-force-wordpress-thumbnails-to-stretch-to-fit-if-uploaded-image-has-smal
Add this code to your functions.php to strip the hardcoded width and height of the images that are integrated inside WordPress:
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );
function remove_thumbnail_dimensions( $html ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
and you will need to add the following line to your active theme’s style.css to stretch the image:
.attachment img {
width: 100%; /* scale to width of container, or whatever you want */
}
Just make sure you are using the correct selector and width / height in your CSS.
Related Posts:
- How to automatically add rounded corners to thumbnails?
- WP 4.4. responsive images browser choosing the “wrong” one
- Retina images – custom syntax for inserting images into post content
- show author image in posts
- Default Image Link Removal
- How to limit number of images being printer out in “Set Featured Image” pop up?
- Replace Woocommerce Images
- How to copy and paste a picture found on the web to wordpress easily
- Graphing libraries for WordPress [closed]
- Dynamically add titles to post images if they are empty
- How can I make all gallery images to open in a new window?
- Cropping an image before inserting into a post
- custom image size with New Media Manager in wordpress 3.5
- Uploading images: ‘ø’ get replaced with ‘ø’
- SSL: How to make customizer images Protocol Relative in WordPress?
- Is there a way to pull the first featured image in a loop and not all other featured images?
- How to add qtranslate multi language support for media?
- how to stop generating different image sizes from parser
- Change the URL of an image from wp_get_attachment_image_src
- custom image dimensions (for gallery)
- Do I need to resize an image to fit the post?
- Link to large image version instead of original?
- Some images not found 404 in localhost
- wp_upload_bits does not retrieve images that do not have an extension
- Images will not display, when I call them up with html in wordpress, just two blank small spaces [closed]
- Loose images in uploads folder
- Force minimum image size and aspect ratio when uploading images
- Convert uploaded GIF to non animated image automatically
- Is it possible to split Default WP Media directory to multiple Folder/Subdomain?
- Add srcset and sizes to older uploads?
- Divi Theme – images not showing on front page [closed]
- Edit image results in copies of file being created
- Images in Media aren’t showing, not broken
- Fixing image names for a site being restored
- Upload Image using wp_insert_attachment and file url don’t have file extension
- t5-fresh-editor-stylesheets.php breaks image placement in WP Beta 3 editor
- Find and Use an image’s caption
- Export xml use/import images from theme directory
- Is it possible to change image size used for preview thumnail in Add Media popup
- Custom header tiling?
- Images showing in editor but not in post [closed]
- Why are featured images sometimes cropped, and sometimes not
- Call to undefined function wp_generate_attachment_metadata()
- the_post_thumbnail(‘medium’) setting some images width=1 height=1
- Help with resizing of featured images on WooCommerce homepage
- How to set uploaded image as featured image wordpress
- Random background image showing on website per click/load
- Why WordPress suddenly changed sizes of thumbnails?
- How to force WordPress to upscale images?
- How to stop WordPress from completely overriding my tags in my templates?
- Number of Style for Image Added into Post
- How can i add a section of category image upload during adding of category in wp admin area?
- remove enclosure url from feed
- add_image_size not working
- Show last 12 uploaded images on home page, but only from posts
- How to change the value “uploaded to” in the media library (WordPress 4.0)
- Thumbnails different sizes
- For a complete backup, is it enough to copy htdocs and export database?
- What exactly is the description field when uploading an image?
- Photos automatically uploaded to Media Library
- Failed to load resource:404 image
- Slidedeck Pro WordPress Image Size
- Thumbnail and image management
- Change Image Size option in the settings in bulk
- Crop tool do not work
- Profile image does not upload
- Allow wp media library to check already selected images displayed in div
- How is called this thumbnail slider feature
- Rebuilding core image block
- Loading and Referencing Images
- ALT attribute in menu images
- Import images from old WordPress site into new site
- Images 404 after wp migration to a subdomain
- Custom image sizes quality
- built-in responsive images in content – do I need to add anything to functions.php?
- Widget media uploader doesn’t opens after widget save
- How to source control manage site images
- How to display image thumbnails on the search results page?
- How to modify images during upload
- Change Featured Image Size of the Post
- Surround uploaded image link with div
- Why WordPress doesn’t show pictures when I upload them in a new post?
- Import existing image as a single post
- How can i make like this structure?
- Slider do not add alt attribute. Cant get alt attribute from a media library!
- Broken image URL
- Stop Attachment image names from taking top level permalink
- Media Library is not loading on grid view in admin panel
- Image not showing in an archive page
- How can I put pictures next to each other and how can I add a location? [closed]
- Media upload error
- Featured Image not displaying [closed]
- Remote Image (from URL) as Media Library element
- Why are some SVG-images not visible in my footer?
- How To Get Feature Image from Blog in Same WordPress Multisite Blog on the Parent Blog?
- WPALLIMPORT Exporting images from repeater field [closed]
- What does WordPress media uploader do to image files on upload?
- Site header logo and parallax image on homepage do not display on iPhone
- image_get_intermediate_size always returns false
- Change of displayed images for webp versions