How to retrieve images contained in a post

I’m guessing you’ll need to fetch the post content and parse it using something like this as a guide (pasted code from above link for future reference).

// Get the all post content in a variable
$posttext = $post->post_content;
$posttext1 = $post->post_content;

// search for the src="" in the post content
$regular_expression = '~src="[^"]*"~';
$regular_expression1 = '~<img [^\>]*\ />~';

// grab all the images from the post in an array $allpics using preg_match_all
preg_match_all( $regular_expression, $posttext, $allpics );

// Count the number of images found.
$NumberOfPics = count($allpics[0]);

// This time we replace/remove the images from the content
$only_post_text = preg_replace( $regular_expression1, '' , $posttext1);

// Check to see if we have at least one image
if ( $NumberOfPics > 0 )
{
/* profit */
}

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş