1
This commit is contained in:
@@ -428,7 +428,7 @@ class Base extends Controller
|
||||
$insert1['article_id'] = $article_id;
|
||||
$insert1['type'] = 1;
|
||||
$insert1['ami_id'] = $c_id;
|
||||
$insert1['content'] = $v;
|
||||
$insert1['content'] = substr($v,0,-2)."imageId='".$c_id."' />";
|
||||
$insert1['sort'] = $k+1;
|
||||
$insert1['ctime'] = time();
|
||||
$this->article_main_obj->insert($insert1);
|
||||
@@ -509,7 +509,7 @@ class Base extends Controller
|
||||
// 处理 TIFF 和 EMF 文件并转换为 JPG
|
||||
file_put_contents($base_url . $newFileName, $fileContent);
|
||||
$insert['article_id'] = $article_id;
|
||||
$insert['url'] = $article_id . "/" . $newFileName;
|
||||
$insert['url'] = $this->crossTifToPng($article_id . "/" . $newFileName);
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_image_obj->insert($insert);
|
||||
} elseif ($extension == "docx") {
|
||||
@@ -528,8 +528,9 @@ class Base extends Controller
|
||||
}
|
||||
$file_runs = $res['data']['list'];
|
||||
foreach ($file_runs as $val) {
|
||||
$ex = pathinfo($val,PATHINFO_EXTENSION);
|
||||
$insert['article_id'] = $article_id;
|
||||
$insert['url'] = $val;
|
||||
$insert['url'] = ($ex=="tif"||$ex=="tiff")?crossTifToPng($val):$val;
|
||||
$insert['ctime'] = time();
|
||||
$this->article_main_image_obj->insert($insert);
|
||||
}
|
||||
@@ -543,6 +544,17 @@ class Base extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function crossTifToPng($tif_url){
|
||||
$url = $this->ts_base_url . "api/typeset/crossImage";
|
||||
$program['url'] = $tif_url;
|
||||
$res = object_to_array(json_decode(myPost($url, $program)));
|
||||
if (!isset($res['data']['file'])) {
|
||||
return;
|
||||
}
|
||||
return $res['data']['file'];
|
||||
}
|
||||
|
||||
public function isImageTag($str) {
|
||||
// 正则表达式匹配 <img> 标签,忽略大小写
|
||||
$pattern = '/^\s*<img\s+[^>]*\s*src=["\'][^"\']+["\'][^>]*>\s*$/i';
|
||||
|
||||
Reference in New Issue
Block a user