Get all image src values from HTML
// Get all image src from HTML content
function my_get_images_from_content( $html ) {
$doc = new DOMDocument();
@$doc->loadHTML( $html );
$imageTags = $doc->getElementsByTagName( 'img' );
$all_images = array();
foreach( $imageTags as $tag ) {
$all_images[] = $tag->getAttribute( 'src' );
}
return implode( ",", $all_images );
}