解决同一上传图片插入多次但发布后只显示一次 [复制链接]

moqu8 2019-8-10

6 0
在编辑器中上传一张图片,插入多次后编辑器里会显示多次,但发布后帖子里只显示一次

修改文件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. }
复制代码

最新回复 (0)
返回
支持中心
邮箱:winkill2012@qqcom
新站优化中!部分功能尚未完善,敬请谅解!
支持中心