dz解决同一上传图片插入多次但发布后只显示一次问题

[复制链接]
查看2652 | 回复0 | 2020-2-19 09:22 | 显示全部楼层 |阅读模式
discuz在编辑器中上传一张图片,插入多次后编辑器里会显示多次,但发布后帖子里只显示一次
修改文件source/function/function_attachment.php
查找

  1. foreach($findattach[$pid] as $aid => $find) {
  2.        $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
  3.        $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
  4. }
复制代码
替换为
  1. foreach($findattach[$pid] as $aid => $find) {
  2.          //$postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
  3.         //$postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);

  4.         preg_match_all($find, $postlist[$pid]['message'], $sameattach);
  5.         foreach($sameattach[0] as $key => $value){
  6.                 $tempattach = $postlist[$pid]['attachments'][$aid]['aid'];
  7.                if(count($sameattach[0]) > 1 && $key > 0) {
  8.                           $postlist[$pid]['attachments'][$aid]['aid'] = $postlist[$pid]['attachments'][$aid]['aid'].'_'.$key;
  9.                           $GLOBALS['aimgs'][$pid][] = $postlist[$pid]['attachments'][$aid]['aid'];
  10.                }
  11.                $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
  12.                $postlist[$pid]['attachments'][$aid]['aid'] = $tempattach;
  13.         }
  14. }
复制代码

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
1
贡献
387
丢币
38902
主题
4607
回帖
116
注册时间
2018-9-25
最后登录
2024-4-16