diff --git a/packages/block-library/src/image/index.php b/packages/block-library/src/image/index.php
index 3c90f0fbc21cfe..70a40f4b59db9c 100644
--- a/packages/block-library/src/image/index.php
+++ b/packages/block-library/src/image/index.php
@@ -75,8 +75,17 @@ function render_block_core_image( $attributes, $content ) {
'';
$body_content = preg_replace( '/
]+>/', $button, $body_content );
- $background_color = esc_attr( wp_get_global_styles( array( 'color', 'background' ) ) );
- $close_button_icon = '';
+ // Add directive to expand modal image if appropriate.
+ $m = new WP_HTML_Tag_Processor( $content );
+ $m->next_tag( 'img' );
+ $m->set_attribute( 'data-wp-context', '{ "core": { "image": { "imageSrc": "' . wp_get_attachment_url( $attributes['id'] ) . '"} } }' );
+ $m->set_attribute( 'data-wp-bind--src', 'selectors.core.image.imageSrc' );
+ $modal_content = $m->get_updated_html();
+
+ $background_color = esc_attr( wp_get_global_styles( array( 'color', 'background' ) ) );
+
+ $close_button_icon = '';
+ $close_button_color = esc_attr( wp_get_global_styles( array( 'color', 'text' ) ) );
$dialog_label = $alt_attribute ? esc_attr( $alt_attribute ) : esc_attr__( 'Image' );
$close_button_label = esc_attr__( 'Close' );
@@ -94,10 +103,10 @@ function render_block_core_image( $attributes, $content ) {
data-wp-on--mousewheel="actions.core.image.hideLightbox"
data-wp-on--click="actions.core.image.hideLightbox"
>
-