まずhtmlからaタグを抜き出し、それらに所定のフルパスの画像がimgタグのsrcとして
内包しているかチェックすればいいのでは?
たとえばこんな感じ
PHP
1$html=<<<eof
2<a>test</a>
3<img src="http://sample.jp/image.jpg" alt="" />
4<a>test</a>
5<a href=""><IMG src="http://sample.jp/image.png" alt="" /></a>
6<a href="" title="" target=""><img src="http://sample.jp/image.gif" /><br>texttexttext</a>
7<a href="">test
8test<img src="http://sample.jp/image.gif" />test
9test</a>
10eof;
11
12$urls=[
13 "http://sample.jp/image.jpg",
14 "http://sample.jp/image.png",
15 "http://sample.jp/image.gif",
16 ];
17foreach($urls as $url){
18 print $url.":".check($html,$url)."<br>";
19}
20
21function check($html,$url){
22 $pattern_a="/<a .*?<\/a>/mis";
23 $pattern_img="/<img .*?src=([\"'])".preg_quote($url,"/")."\\1.*?>/i";
24 if(preg_match_all($pattern_a,$html,$matches_a)){
25 foreach($matches_a[0] as $match_a){
26 if(preg_match($pattern_img,$match_a)){
27 return "OK";
28 }
29 }
30 }
31 return "NG";
32}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。