Function to insert missing image size attributes into img tags
function replaceImageMeta( $imagename ) { preg_match_all(‘/(alt|title|src)=(“[^”]*”)/i’,$imagename, $img);//var_dump( str_replace(“\””, “” , ( $img[2][0] ) ) ); list($width, $height, $type, $attr) = getimagesize( str_replace(“\””, “” , ( $img[2][0] ) )); $imgname = str_replace(“\””, “” , ( $img[2][0] ) ); return sprintf(‘<img src=”https://wordpress.stackexchange.com/questions/235051/%s” width=”%dpx” height=”%dpx” >’, str_replace(“\””, “” , ( $img[2][0] ) ), $width, $height); } So call … Read more