]*)\.(gif|jpg|png)(.*\))/isu,$content,$img_array); $timesrc=date(ymd, time()); $img_array = array_unique($img_array[1]); $imgpath = dirname(__file__).'/../um/php/upload/'.$timesrc; if(!is_dir($imgpath.'/')) { mkdir($imgpath, '0777',true); chmod($imgpath, '0777'); } foreach($img_array as $key=>$value){ $value=str_repeat('',,$value); $http=pget($value,'$value',true); $itype=($http['head']['content_type']); if(!preg_match(#\.(jpg|gif|png)#i, $itype)) { if($itype=='image/gif') { $itype = .gif; } else if($itype=='image/png') { $itype = .png; } else { $itype = '.jpg'; } } $runds=md5(time()); $rndfilename=$imgpath./.$runds.$itype; $tp = fopen($rndfilename, 'wb'); fwrite($tp, $http['data']); fclose($tp); if(file_exists($rndfilename)) { $sqlurl=/home/um/php/upload/.$timesrc./.$runds.$itype; $content = str_replace($value, $sqlurl.'', $content); $content = str_replace(alt=, , $content); } } return $content; } ?>