By default add_image_size
will attempt to resize your custom image sizes instead of cropping them (see the fourth argument in the function).
So you have a couple of options here…
- Perform a crop by passing
true
for the fourth argument ofadd_image_size
, or customize how the crop will be positioned by passing an array for the fourth argument (see documentation). This will force the image dimensions to be resized exactly as defined (for example ‘home-thumbnail-highlight’ will be 694×381) - Set the
height
to a very high value and do not pass a fourth argument for cropping (to perform a resize).
For example:
add_image_size('home-thumbnail-highlight', 694, 99999);
add_image_size('home-thumbnail', 330, 99999);
add_image_size('listing-thumbnail', 342, 99999);
add_image_size('sidebar-small-thumbnail', 300, 99999);
This will force your custom sizes to always constrain at the width instead of the height.
Related Posts:
- How to make WordPress use protocol indepentent upload files?
- Find unused images?
- wp_generate_attachment_metadata is creating an empty array
- How to upload WordPress Images to remote web server and display those images in WordPress gallery [closed]
- How To Convert External Image URLs To Own Website’s Uploaded Images Automatically?
- wp.media.view.ImageDetails – Save settings as HTML5 data-* attributes for image
- “Add Media” button in custom plugin
- Remote upload file to server B
- What plugin can I use to create a list / slideshow of featured images?
- Upload specific images to specific folder
- Any plugin out there that uses WP’s internal image uploader?
- How to upload image with simple form?
- Resizing all images
- Way to force media uploader use custom image size
- How to create an edit media button for slideshow plugin?
- Use Media Uploader in Plugin
- Upload images from custom plugin using the media modal
- How to upload thousands of images?
- Saving/Writing/Adding file to upload folder
- How do I create a full-bleed background image on text mouseover? [closed]
- How to import 55k images (uploaded via FTP) into WordPress Media libary? [closed]
- Bulk Image Uploader to create new post from each image [closed]
- Adding Attachment Display Settings in custom media frame
- How to upload images to WP Panel keeping correct folder in FTP
- Media upload not working on theme option in WordPress 3.8.1
- How organize uploaded media in WP?
- Plugin or method to delete uploads not in media library?
- Restrict media upload size by format
- Auto move media file to cloud
- Retrieving Meta from Image Attachment
- media page returnig to 404 in rtmedia [closed]
- Bulk Image Upload And Rerrange Functionality
- Redirect to another page using contact form 7? [closed]
- adding a button to the media uploader
- How to accept images at multiple sizes and aspect ratios and display as standardized image size / ratio?
- Large amount image data transfer
- Simple sildeshow/image-upload plugin?
- Bulk Image Resize for Media Library, but for ENLARGING instead of Shrinking
- Is there a way to auto generate poster image for videos
- How to Upload images to a custom folder in upload folder using media uploader
- what functions to use to resize images and create DB metadata for them after/during upload?
- Remove special characters from filenames
- multiple image upload using wp_enqueue_media
- Uploading images to custom table
- Media library and Upload media problem
- Where to store media uploaded by the plugin?
- How to prevent intermediate images from being created but keep the sizes available for selection in the media library?
- Upload the images folder with sub-folders directly to server
- Allow all file types for upload
- There’s a way to scale media (images) at 50%?
- Display (and manage) webcam images?
- Cropping, Re-sizing and Saving images from one folder to another folder in wordpress
- Alter media caption/description conflict in WordPress?
- Using the media uploader in a custom plugin
- How do I change the description of the same image which is to be found in multiple instances?
- How to extract images of post and pages excluding header and logo image in wordpress?
- How to add a media with PHP
- Converting a simple plugin to be placed inside of functions.php
- Multisite media library uploads broken images
- Different upload path per file type
- Get the url of the full sized attachment image using post ID?
- Image gallery plugin [closed]
- How do I create a custom add media button modal?
- How can I implement an Add to Collection function on my Image Gallery to be downloaded later?
- How can I create more upload paths, like a post corresponding to a post title folder used to store images of the same product
- How can I restrict image upload dimensions for non-admin WordPress users?
- Add padding while generating thumbnail
- Media Upload Tab reload and change $_GET
- Image Manager Plugin [closed]
- Fullscreen Video/GIF Intro
- Upload media only to DB
- Adding Static Image to WooCommerce Content-Single-Product template
- custom uploader in the admin area
- Is there a way in WordPress to convert images to WebP without a plugin?
- Programatically upload a file to be stored inside blob field in database, NOT on filesystem
- Issue with wp_handle_upload
- Disable image rename on upload
- Add a file upload field
- How can i identify media uploaded to my website that is not being used anywhere anymore?
- image URL changed in wordpress
- How to move an image in a plugin to the upload directory and make it as a media of wordpress?
- Looking for a photo management solution
- Elementor Pro display featured image on section -> style -> image using shortcode
- Can export gallery but can’t import it Wp all import
- WordPress append -1 to the image name
- Display Multiple Photos as Featured Image when mouse moves on to it post
- Which post/page an image is attached to
- Updated wordpress missing image upload area
- Image paths wrong after migrating with wp-migrate-db-pro media files add-on
- Set default “Link CSS Class” in add media admin editor
- Does WordPress have a way of changing the ‘Natural’ size of uploaded images?
- How to create an uploads subfolder on a multisite setup?
- how to open image gallery in a post/page?
- Determine if get_the_image has image on Get the image Plugin
- How should I force WordPress to give proper name for the uploading images?
- Want to show pop up image on home page every time when i refresh it [closed]
- wp_handle_upload – specified file failed upload test
- Increased max_upload_filesize, but still can’t upload plugin [closed]
- How to connect WordPress media to another host?
- I want to allow certain file types on dokan upload files