0
을 완료하고 난 내 사용자가 내가 태그로 이미지 URL로 변경됩니다 이미지 URL을 게시 할 수 있도록하려는이미지 URL을 변환하면 내가 코멘트 일 일하고 HTML 이미지 태그
내 기능
function ImageTag($text) {
// The Regular Expression filter
$reg_exUrl = "/(http|https)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
// The Text you want to filter for urls
if(preg_match_all($reg_exUrl, $text, $url)) {
// make the urls hyper links
$matches = array_unique($url[0]);
foreach($matches as $match) {
$check = substr($match, -4);
if ($check == ".jpg" || $check == ".png" || $check == ".gif" || $check == "jpeg" || $check == ".JPG" || $check == ".PNG" || $check == ".GIF" || $check == "JPEG"){
$replacement = "<br/><img src=$match>";
$text = str_replace($match, $replacement, $text);
}
}
return nl2br($text);
} else {
// if no urls in the text just return the text
return nl2br($text);
}
}
$text = "The text you want to filter goes here. <img src='http://static.php.net/www.php.net/images/php.gif'> http://www.facebook.com http://static.php.net/www.php.net/images/php.gif";
$content = ImageTag($text);
echo $content;
나는 반 제 기능을 수행하고있다하지만 난이 내가 무엇입니까 무엇
html 태그 이미있는 이미지를 해결하는 방법을 잘 모르겠습니다
소스 코드 :
The text you want to filter goes here. <img src="<br/><img src=http://static.php.net/www.php.net/images/php.gif>"> http://www.facebook.com <br><img src="http://static.php.net/www.php.net/images/php.gif">
와 'SRC ='을 대체 이미지에 대한 데이터 URI? – Anthony
데이터 uri에 대해서는 알지 못하지만 확인하겠습니다. – deerox
대신/스크린 샷을 게시하는 것 외에도 원본 (사용자 제공) 텍스트 및 생성 된 HTML을 게시하는 것이 도움이 될 것입니다. – Passerby