$pattern = '/(ttps?)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\.(jpg|gif|png)/';
preg_match_all($pattern, $body, $matches);
if(count($matches)){
foreach($matches[0] as $i=>$url) {
$replace = "<img src='h{$url}'>";
$images[] = $replace;
$body = str_replace($url, $replace, $body);
}
}
0 件のコメント:
コメントを投稿