The following method is very simple, we only need to delete all the websites opened with http:// in $tmppath,
$picpath =preg_replace("/[a-za-z]+://[^ |/|s]*/",'',$tmppath);//Remove the URL part
This regular expression is to get all the addresses of all pictures in the string using src src regardless of size, and save them in $tmpdata[2].
preg_match_all("/src=["|'|s|s]([^|/|>]*){0,}(([^>]*).(gif|jpg|png))/isu ",$body,$tmpdata);
$picspath =array_unique($tmpdata[2]);//The addresses of all pictures in the body