HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/insiders/wp-load/wp-content/plugins/gutenmate/block-extensions/core-image.php
<?php

defined( 'GTM_IS_AUTO_FIX_CORE_IMAGE_URL' ) || define( 'GTM_IS_AUTO_FIX_CORE_IMAGE_URL', true );

/**
 * To fix the image url that may different between dev & demo site.
 * Usually caused in template parts. This feature can be disabled safely.
 */
if ( GTM_IS_AUTO_FIX_CORE_IMAGE_URL ) {
	add_filter( 'render_block_core/image', 'gtm_render_block_core_image', 10, 2 );
	function gtm_render_block_core_image( $block_content, $block ) {
		if ( ! empty( $block['attrs']['id'] ) ) {
			$img_url = wp_get_attachment_image_url( $block['attrs']['id'], $block['attrs']['sizeSlug'] ?? 'full' );

			if ( ! empty( $img_url ) ) {
				return preg_replace( '/<img src="[^"]+/', '<img src="' . esc_url( $img_url ), $block_content );
			}
		}

		return $block_content;
	}
}