hotfix/远程访问多媒体中心
LMR 7 years ago
parent af050c596f
commit a9145b28f1

@ -382,25 +382,25 @@ class Info_amp extends CI_Controller
} }
$md5_name = $md5_file.$ext; $md5_name = $md5_file.$ext;
$path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name); $path = realpath('../cht-system/views/information/word_source').'/'.basename($md5_name);
$html = realpath(APPPATH.'/libraries/composer/vendor/'); $html = 'to use mammoth';
if (move_uploaded_file($file['tmp_name'], $path)) { if (move_uploaded_file($file['tmp_name'], $path)) {
$this->load->library('wordphp'); $docx_dir = realpath('../cht-system/views/information/word_source');
$rt = new WordPHP(); $img_dir = $docx_dir.'/'.$md5_file;
$rt->img_dir = realpath('../cht-system/views/information/word_img'); @mkdir($img_dir, 0700);
$rt->img_prex = $md5_file; $html_parh = $img_dir.'/'.$md5_name;
$html = $rt->readDocument($path); //运行docx转化插件
$html = str_ireplace($rt->img_dir, '//202.103.68.62:9096/information-view/information/word_img', $html); $command = 'C:\Users\cht77\AppData\Local\Yarn\bin\mammoth '.$path.' --output-dir='.$img_dir;
/*//phpWord转HTML exec($command, $rs);
require_once($html.'/autoload.php'); $html = file_get_contents(str_ireplace('.docx', '.html', $html_parh));
$phpWord = \PhpOffice\PhpWord\IOFactory::load($path); //图片前缀
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "HTML"); //$html = str_ireplace($img_dir, '//202.103.68.62:9096/information-view/information/word_source', $html);
$xmlWriter->save($path.'.html'); if ($html) {
*/ echo(json_encode(array(
echo(json_encode(array( 'status' => 'success',
'status' => 'success', 'path' => $path,
'path' => $path, 'html' => $html
'html' => $html )));
))); }
} else { } else {
echo(json_encode(array( echo(json_encode(array(
'status' => 'error', 'status' => 'error',

Loading…
Cancel
Save