[Discuz]
解决编辑器图片插入多次但发布后只显示一次问题
|
在编辑器中上传一张图片,插入多次后编辑器里会显示多次,但发布后帖子里只显示一次!
需要修改的文件:source/function/function_attachment.php
查找以下代码一般在166~169行:
- foreach($findattach[$pid] as $aid => $find) {
- $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
- $postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
- }
复制代码 替换成:
- foreach($findattach[$pid] as $aid => $find) {
- //$postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
- //$postlist[$pid]['message'] = preg_replace($find, '', $postlist[$pid]['message']);
- preg_match_all($find, $postlist[$pid]['message'], $sameattach);
- foreach($sameattach[0] as $key => $value){
- $tempattach = $postlist[$pid]['attachments'][$aid]['aid'];
- if(count($sameattach[0]) > 1 && $key > 0) {
- $postlist[$pid]['attachments'][$aid]['aid'] = $postlist[$pid]['attachments'][$aid]['aid'].'_'.$key;
- $GLOBALS['aimgs'][$pid][] = $postlist[$pid]['attachments'][$aid]['aid'];
- }
- $postlist[$pid]['message'] = preg_replace($find, attachinpost($postlist[$pid]['attachments'][$aid], $postlist[$pid]), $postlist[$pid]['message'], 1);
- $postlist[$pid]['attachments'][$aid]['aid'] = $tempattach;
- }
- }
复制代码 通过以上方法我们可以多次凋用同一张图片在不同的地方,比如一些常用的分割线。
[occ]文档来源:网络转载 https://www.dismall.com/thread-2233-1-1.html[/occ]
|
|
免责声明:
1. 本站所有资源来自网络搜集或用户上传,仅作为参考不担保其准确性!
2. 本站内容仅供学习和交流使用,版权归原作者所有!© 查看更多
3. 如有内容侵害到您,请联系我们尽快删除,邮箱:csd@openjq.com
|
|
|
|