](?!(height|width)=))*+>/i', $buffer, $images_match ); foreach ( $images_match[0] as $image ) { // Don't touch lazy-load file (no conflit with Photon (Jetpack)). if ( strpos( $image, 'data-lazy-original' ) || strpos( $image, 'data-no-image-dimensions' ) ) { continue; } $tmp = $image; // Get link of the file. preg_match( '/src=[\'"]([^\'"]+)/', $image, $src_match ); // Get infos of the URL. $image_url = wp_parse_url( $src_match[1] ); // Check if the link isn't external. if ( empty( $image_url['host'] ) || rocket_remove_url_protocol( home_url() ) === $image_url['host'] ) { // Get image attributes. $sizes = getimagesize( ABSPATH . $image_url['path'] ); } else { /** * Filter distant images dimensions attributes * * @since 2.2 * * @param bool Do the job or not */ if ( ini_get( 'allow_url_fopen' ) && apply_filters( 'rocket_specify_image_dimensions_for_distant', false ) ) { // Get image attributes. $sizes = getimagesize( $image_url['scheme'] . '://' . $image_url['host'] . $image_url['path'] ); } } if ( ! empty( $sizes ) ) { // Add width and width attribute. $image = str_replace( '