您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP 远程图片本地化

2024/4/18 1:23:00发布10次查看
]*)\.(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; } ?>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product