A simple and effective approach
const editor = wp.data.select('core/editor');
const imageId = editor.getEditedPostAttribute('featured_media');
const imageObj = wp.data.select('core').getMedia(imageId);
ImageObj gives you a reasonable amount of image data to work with.
Related Posts:
- How to extend the gallery block in Gutenberg?
- Set default image link target in Gutenberg image block
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- get_post_gallery with Gutenberg
- How to include externally hosted images into a gallery block
- Apply image width to tag
- How to link Gutenberg Gallery images To Media file automatically?
- Find posts without featured image? [duplicate]
- How to get relative URL of medium sized featured image?
- How to set the width and height rule for featured image
- How to Add extra option to Image Block Settings?
- @wordpress/create-block image url in css
- How to remove buttons from gutenberg toolbar
- Extend core block attributes in post content
- hardcrop images in gutenberg “latest posts” block
- Bulk edit Gutenberg single images to change from linking to media file to attachment page
- Trying to create a mouseover effect in html using Gutenberg editor
- Big Image on Featured Post, Normal on Single Post
- How to use photo in multiple posts?
- Prevent Image Pasting in RichText Component
- Multiple amp-image overlays. How to properly do this in wordpress?
- Update an image block style programatically
- Add width & height attributes to Gutenberg’s image output?
- update_post_meta attachment_image_alt description for Gutenberg
- Setup Featured image on all posts from thesis thesis_post_image custom field?
- How to get the Gallery form/section just like in Gutenberg block?
- Is there a wordpress filter to edit the markup of inline images?
- How to upload and style svg logo?
- Weird failing request
- How can I check if the first block is an image aligned left or right?
- Not seeing text alignment option in Image block
- How do I link a featured photo to it’s post?
- Place image caption outside of figure tag (Gutenburg Image Markup)
- Change Image Size option in the settings in bulk
- How to disable a WP Image Block to link to itself?
- get_post_gallery with Gutenberg
- How to join Caption AND Description Meta Fields as one combined-caption in Image Block
- Using srcsets in a custom block
- Rebuilding core image block
- A query to substitute images paths in gutenberg (website migration)?
- Convert multiple image blocks to gallery block in Gutenberg?
- get_post_gallery with Gutenberg
- Title image is missing ( but is not the WP 3.5 issue )
- Custom filename when pasting an image from clipboard
- Orientation of featured image in post?
- How to show file size of featured image? [duplicate]
- How to show file type of featured image?
- Multisite image URLs incorrect in editor
- Gutenberg block HTML image rendering override
- Saving the pre-sanitized filename of an attachment as the Title or Caption
- Add aditional class to get_avatar when showing image
- Alter media caption/description conflict in WordPress?
- Loop through child images of a parent for a Nivo Slider
- Rename attachments during upload
- Limit author image size
- Remove the http protocol from images
- Display one random image, but only if landscape
- Populate a slideshow list of images from images in a wordpress page?
- Resizing image into thumbnail, small, medium and large options greyed out
- Add multiple images to author profile page
- Is there a plugin or simple way to add a multiple images metabox to a post?
- Show media url immediately after upload in media uploader
- Is this post using WordPress Gallery?
- How to open default wp image editor screen dynamically?
- Add select input with pre defined classes to insert image screen?
- Is there a way to change all already uploaded images which are PNG and convert them to JPG?
- Auto delete attachments that are older than x days
- attach image from library to post with wp_insert_attachment
- Bulk-add featured images in posts with no featured image
- How to get image from media library with URL [duplicate]
- WordPress Creates Unused (Unregistered) Image Sizes
- Custom image uploader without widgets
- How to change the catalog product image size by product id?
- are unattached media files a problem?
- Disable image rename on upload
- Development environment and “production” environment domains
- HTTP error when uploading an image
- Why am I getting and error from wp_get_attachment_image_src?
- How to get post id of first child of the same post type?
- Product Images Making a Column
- What’s are some best practices for responsive images (e.g. for section headers)?
- Recreate the upload folder from a website without having access to the backend/cpanel/filezilla directly from the website
- how automatically show the image title before the image caption/description in a wordpress gallery?
- Hot Linked Own Images
- How to set a post featured image from an already made custom field
- Alt attribute is not showing while the value is given in Media
- Alternative image sizes are too large
- How to call thumbnail by aqua resizer in best practice. Specify image dimensions’s notify from GTmetrix
- How do i replace the title attribute of img tag with the image caption
- Why are my ‘medium’ images the wrong size
- How can I hide previous_image_link() on first attachment page?
- Theme files and imagesnot loading on a mobile device
- Guaranteed Image Sizes
- get_theme_file_uri function not showing background image inside data-setbg in html
- 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]
- set_post_thumbnail or media_sideload_image adds image multiple times in media library
- image_get_intermediate_size always returns false
- Change of displayed images for webp versions