You can use add_image_size to create your custom size like this:
add_image_size( 'featured-works', 220, 180, true );
then get it like this:
wp_get_attachment_image_src($thumbnail_id,'featured-works');
take into account how the crop works here
Related Posts:
- What’s the best way to use the Featured Image for responsive web design?
- How do I hook into WordPress to save an uploaded photo as an alternate size to an existing photo?
- How to check if image is already stored in a site’s post database? (network)
- Adding a custom image upload size and making it selected by default?
- Hide custom image sizes from media library
- How to draw media details for Isotope gallery using Photoswipe
- Create Image Uploader for Widget
- Permanently remove first image from posts
- Admin Media grid view images won’t load
- WordPress remove EXIF Data from specific Thumb
- How to resize image on client-side before upload?
- Adding Featured Image to Post programatically
- Get a Page’s attachments in Gallery order
- How to get custom image size for image uploaded in Customizer
- Using wp_get_image_editor in a standalone script
- Styling images coming from another blog
- IMG src weird behaviour inside a single post loop
- Escape post image attachments added to template
- Display post image with fancybox
- How to get media objects
- PHP code to call image Caption, Alternative Text, and Decription?
- Echo URL of large version of Featured Image
- Change the URL of an image from wp_get_attachment_image_src except in the frontpage
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- How to get specific image in media library with php
- hover image appears below placeholder instead of overlayed
- Add custom url to featured image
- Cannot display or echo alt text on featured image
- Best practice for migration friendly images in posts/pages?
- Get the post ID and display the images
- Responsive Header for Phone
- Unread Repeater field IMG alt not working
- Upload multiple images to a Woocomerce product
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- Accessing an image folder inside public web directory
- Why my image upload button is not working in wordpress widget area?
- How to make own crop image function for WordPress plugin
- WordPress function when file is uploaded, deleted or edited
- Download images from media library to computer in BULK?
- Three Questions with Twenty Eleven theme
- How to loop through all the attached images in a post, and get their url one by one
- Division by zero error in image.php
- How can I automatically resize up images to fit into all of my registered image sizes
- Clickable image link sends people to wrong URL
- Only show image from custom field when present
- Timthumb.php image gallery not working on Multisite WordPress
- Upload non-featured image to image field
- Change default gallery images – Currently they are displaying full size imagese
- I’m unable to call img path using single quotes in an array?
- Creating black and white copy of an image [closed]
- Get the id of all images in a post
- Display an image based on field value
- Else/If Statement to Display Photo Descriptions
- How to set a featured image (thumbnail) with PHP?
- Controlling image output size ACF repeater [closed]
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- WordPress İmages Upload & Delete Error
- Attaching images to posts manually (i.e. with custom code, without the use of an API)
- Adding a ‘style=’ bit to image_send_to_editor output
- How to internationalize header image?
- Some problems in custom widget
- Displaying images outside the content
- Checking page before applying image restrictions while uploading
- Generate images with html2canvas and the woocommerce api
- WordPress api post image raw data without being blank in media library
- Retrieve alt text by referencing the img src
- Show next image in array if page is revisited by same logged user
- WordPress loading all local images from specific directory?
- Update Images after edit via php
- I have a background-image in css file but don’t show in site.how to fix this prblm. i sent screenshot. thx
- How do I stop an Image Address from loading in the Browser?
- How to get the url of the entry in which an image belongs
- How to add a PHP scripts into WordPress
- How to create an unordered list of images separate from the content
- How to include different html tags in the header for different pages?
- How do I get the featured post to share on Social Media and show on Individual Post pages?
- How do I routinely extract the thumbnail of the most recent post?
- add class to background image
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Save the outputted image into the Media Library, with a different filename and extension
- How to resize an image server-side before upload?
- Creating image gallery in wordpress
- Image limit from 1 to 5
- Name Input from widget displays Sidebar name instead of saved data
- Gallery requires a featured image but does not show it in posts/pages
- Snapshot Theme from WooThemes — empty ‘alt’ attribute
- Changing 2011 theme header image based on user dropdown
- Setting post thumbnail sizes in template file and functions.php
- Determine if only one image attached to a post/page
- PHP-Code inside Href-Tag
- HTML in PHP problem [closed]
- An automatic way to crop images of different sizes
- How to automatically convert images to WebP on WordPress?
- Remove default Image Sizes
- Understanding responsive imagery
- Use URL query string in img src attribute
- Add/alter image attribute before render
- How Create Automatically Image jpg.webp from image .jpg without delete or change original images upload
- How can add alt tag in following code. Image are showing dynamic in wordpress
- HELP PLEASE PHP slider css