So I have a blog post with a $body variable that has the content of the post. This has images and other content in it.
I want to grab the images alone and get an array of the images enclosed in the tag.
$images = strip_tags($body, '<img>');
gives me all the images in one variable, how do i convert this into an array of images?
I am looking for an output array like,
[0] => <img.../>
[1] => <img.../>
You could use preg_match_all to accomplish what you want.
If necessary, you could then examine each $img for a src to get the url of the image.