Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/09/2009, 06:09
bigwhite
 
Fecha de Ingreso: agosto-2009
Mensajes: 247
Antigüedad: 15 años, 7 meses
Puntos: 10
Pregunta Expr reg. p/ remover imagenes

Hola! hice una expresion regular para remover imagenes....... pero me falla con las URLs de Blogger

A ver si alguien....... corriendo el script......se da cuenta de como puedo superar esta dificultad :)

Código PHP:
<?
$html 
='<h1> Pirulex</h1> <p/><img src="http://i201.photobucket.com/albums/aa270/pbozzolo/grafico_imc.gif"/><br/><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_DwcTRHifqbk/RpaGFVZHglI/AAAAAAAAABA/c9fpj7surys/s1600-h/PLC++internet+por+220.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_DwcTRHifqbk/RpaGFVZHglI/AAAAAAAAABA/c9fpj7surys/s320/PLC++internet+por+220.jpg" alt="" id="BLOGGER_PHOTO_ID_5086400255361516114" border="0" /></a> ';

$url"http://i201.photobucket.com/albums/aa270/pbozzolo/grafico_imc.gif";
$html =  chau_img ($html,$url);                     

$url ="http://1.bp.blogspot.com/_DwcTRHifqbk/RpaGFVZHglI/AAAAAAAAABA/c9fpj7surys/s320/PLC++internet+por+220.jpg";
$html =  chau_img ($html,$url);                     


echo 
$html;


Function 
chau_img($html,$url){
 return 
preg_replace("|(<img[\s]{1,}[^>]*src=[\"\']".$url."\/?[\"\'][^>]{0,}\/?>)|siU","",$html);    
}

?>
GRACIAS!