|
Posted by Markus L. on 07/10/05 03:55
Am Fri, 08 Jul 2005 21:49:31 +0000 schrieb JD:
> I have a blog type script, I would like to make it automaticly parse img
> files in the blog entry somehow (ie; If I put "http://www.test.com/me.jpg"
> it will parse it as "<img src="http://www.test.com/me.jpg" border=0
> width="135">"
>
>
> I'm new to PHP I have read about ereg and other functions like it but I'm
> not sure how to achieve this, the output of my blog is from this
>
>
>
> <?php echo $vEntries[$i]['entry']; ?>
>
>
> Any help would be greatly appreciated.
> - Jason
<?php
echo preg_replace('/(http:\/\/)([^ ]+)(\.jpg)/i', '<img src="$1$2$3"
border="0" width="135">', $vEntries[$i]['entry']);
?>
--
-------------------------------------------------------
Try this: SCA the Smart Class Archive for PHP
http://www.project-sca.org
-------------------------------------------------------
Navigation:
[Reply to this message]
|