|
@@ -94,6 +94,47 @@ class body_filder
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private function filter_table($val,$commid)
|
|
|
+ {
|
|
|
+ $style = '/\s*<img\s*[^>]*src\s*=\s*\"([^>\"]*)\"\s*[^>]*>/i';
|
|
|
+ $val = preg_match_all($style,$val,$match);
|
|
|
+ if(!empty($val) && $val > 0)
|
|
|
+ {
|
|
|
+ $imgs = array();
|
|
|
+
|
|
|
+ $num = 1;
|
|
|
+ foreach($match[1] as $url)
|
|
|
+ {
|
|
|
+ $info = pathinfo($url);
|
|
|
+ if(empty($info['extension'])) continue;
|
|
|
+
|
|
|
+ $name = md5($url) . '.' . $info['extension'];
|
|
|
+ $path = self::$down_path . '/' . $name;
|
|
|
+
|
|
|
+ if(file_exists($path) || $this->download($url,$path))
|
|
|
+ {
|
|
|
+ $name = "{$commid}-{$num}.{$info['extension']}";
|
|
|
+ $newpath = self::$save_path . "/{$name}";
|
|
|
+
|
|
|
+ if(file_exists($newpath)) {
|
|
|
+ unlink($newpath);
|
|
|
+ }
|
|
|
+ copy($path,$newpath);
|
|
|
+
|
|
|
+ ++$num;
|
|
|
+ array_push({$name});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(isset($imgs)) {
|
|
|
+ return $imgs;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function fillbody()
|
|
|
{
|
|
|
$tm_goods = Model('tm_goods');
|
|
@@ -107,6 +148,12 @@ class body_filder
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private function layout($pics)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public function proc()
|
|
|
{
|
|
|
$goods = $this->goods_common->field('goods_commonid,goods_body')->limit(false)->select();
|
|
@@ -115,12 +162,18 @@ class body_filder
|
|
|
$body = $val['goods_body'];
|
|
|
$comm_id = $val['goods_commonid'];
|
|
|
$body = $this->filter_gif($body);
|
|
|
- $body = $this->filterex($body,$comm_id);
|
|
|
+ $imgs = $this->filter_table($body,$comm_id);
|
|
|
+
|
|
|
+ if($imgs == false) continue;
|
|
|
+ $body = $this->layout($imgs);
|
|
|
+
|
|
|
if(!empty($body)) {
|
|
|
$this->goods_common->where(array('goods_commonid' => $comm_id))->update(array('goods_body' => $body));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function
|
|
|
}
|
|
|
|
|
|
|