- Kod: Tümünü seç
#
#-----[ BUL ]------------------------------------------
#
$text = preg_replace("#\[img\]
#
#-----[ ÖNCESINE EKLE ]------------------------------------------
#
// mod max img size changed the first pass thingo
preg_match_all( "#\[(img.*?)\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", $text, $matches );
// now we go through these matches and do what's needed
foreach ( $matches[0] as $i => $m )
{
// easier use
$tag = $matches[1][$i];
$url1 = $matches[2][$i];
$url2 = $matches[4][$i];
// if we already tagged this one then we leave it be ;)
preg_match( '#img.*?:(\d+):(\d+)#i', $tag, $match );
if ( empty( $match ) )
{
// get the size so we can store it
if ( !$size = @getimagesize( $url1 . $url2 ) )
{ // image will not get resized
$width = '';
$height = '';
}
else
{
$width = $size[0];
$height = $size[1];
}
}
else
{ // we already have the size
$width = $match[1];
$height = $match[2];
}
$tag = explode( ':', $tag ); // remove any possible left over : stuff
$tag = $tag[0];
// lastly we replace it within the text
$text = str_replace( $m, '[' . $tag . ':' . $width . ':' . $height . ':' . $uid . ']' . $url1 . $url2 . '[/img:' . $uid . ']', $text );
}
#
#-----[ SATIRIN IÇERISINDE BUL ]------------------------------------------
#
$text
#
#-----[ SATIRIN IÇERISINDE ÖNCESINE EKLE ]------------------------------------------
#
//
#
#-----[ SONRASINA EKLE ]------------------------------------------
#
// end mod img size changes
ya arkadaslar satırın içerisinde bul ve once ve sonrasına ekle dıyor guzelde satırın içinde birden fazla $text var hepsine aynı değişikliği uygulayacakmıyım