RE: link on user uploaded pic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Tana [mailto:tana@xxxxxxxxx]
> Sent: Thursday, March 29, 2007 1:02 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  link on user uploaded pic
> 
> Hi
> 
>  which is the best way to change this code
> 
>  <img src="images/user_upload/akarmi.jpg">
> 
> to
> 
>  <a href="images/user_upload/bp_akarmi.jpg"><img
>  src="images/user_upload/akarmi.jpg"></a>
> 
> in html ?
> 
> 
>  ----------------------------
>  Tana


<?php

$imgTag = '<img src="images/user_upload/akarmi.jpg">';

echo preg_replace('/<img src="images\/user_upload\/(.*?)">/', '<a
href="images/user_upload/bp_$1"><img src="images/user_upload/$1"></a>',
$imgTag);

?>

-B

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux