0 votes
2.5k views
in Laravel by
How can I remove the image tags from a paragraph of text?

3 Answers

0 votes
by
<?
    $content = "this is something with an <img src=\"test.png\"/> in it.";
    $content = preg_replace("/<img[^>]+\>/i", "(image) ", $content);
    echo $content;
?>
0 votes
by
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text); 
// output : Test paragraph. Other text

// Note: Allow <p> and <a>
echo strip_tags($text, '<p><a>'); 
// output - <p>Test paragraph.</p> <a href="#fragment">Other text</a>

Refer http://php.net/manual/en/function.strip-tags.php
0 votes
by
This is very simple.

Its on laravel blade, you can do it with CSS.

Related questions

0 votes
1 answer 1.8k views
0 votes
2 answers 5.9k views
asked Jul 17, 2018 in General by anonymous
+2 votes
2 answers 9.8k views
0 votes
0 answers 3.0k views
0 votes
1 answer 2.3k views
0 votes
1 answer 1.8k views
...