升级到3.3.3之后,图片不能居中显示,之前是可以的

网络语言
网络语言 This guy is lazy,Introduction has not been set

2 People liked this article · 2388 views


已经解决:

图片灯箱效果和图片居中设置同时生效,解决方法:http://wenda.wecenter.com/question/32577

链接直接跳转到首页,还得复制链接打开才能跳转到帖子。直接把代码再贴过来吧:

分享一下,能帮到一些朋友也是好的。数据库里存入的代码没变,是在输出到模版的时候,3.3.3有变化,增加了parse_imgs()方法,app\article\main.php中,第69行$article_info['message'] = html_entity_decode(FORMAT::parse_imgs((FORMAT::parse_bbcode($article_info['message']))));这样就得自己修改parse_img()方法了。  


解决方法:修改system\functions.app.php的第238行parse_imgs_callback方法,
function parse_imgs_callback($matches)
{
/*if ($matches[1])
{
TPL::assign('attach', $matches[1]);
return TPL::output('question/ajax/load_img', false);
} //修改3.3.3升级后添加的图片灯箱功能,破坏了编辑器的图片段代码接结构,重新单独给图片添加灯箱部分代码 2019.09.24*/

function parse_imgs_callback($matches)
{
/*if ($matches[1])
{
TPL::assign('attach', $matches[1]);
return TPL::output('question/ajax/load_img', false);
} //修改3.3.3升级后添加的图片灯箱功能,破坏了编辑器的图片段代码接结构,重新单独给图片添加灯箱部分代码 2019.09.24*/
return '<a data-fancybox-group="thumb" rel="lightbox" href="'.$matches[1].'">'.$matches[0].'</a>';
}

//编辑器发布不了最后一行完整代码,总是删除掉部分代码,见图片


}
如果想让添加的代码不写死在php的类中,可以单独再制作一个lightbox.htm模版,模版中是构造灯箱的代码结构,把两个变量插入到模版中,这样以后需要修改代码结构就直接修改模版了。php代码中还只是一个parse_imgs处理图片的方法!但是感觉在读取模版总是不如直接执行代码速度更快一些!所以自己在这里不创建模版了!  

Published on 2019-09-22 23:29

Disclaimers:

This document is written by 网络语言 Original published on WeCenter ,The copyright belongs to the author。

Log in,More exciting content waiting for you to find,Contribute wonderful answers,Participate in comment interaction

go Sign in! No accountgoregister

品山阅水
2019-09-25 09:30
仔细一测,确实有这个问题
chenkaisi92
2019-09-25 09:30
????有用
网络语言
2019-09-24 09:42
图片灯箱效果和图片居中设置同时生效,解决方法:http://wenda.wecenter.com/question/32577
网络语言
2019-09-24 09:42
图片灯箱效果和图片居中设置同时生效,解决方法:http://wenda.wecenter.com/question/32577
网络语言
2019-09-24 09:26
官网的图片放大就是图片灯箱功能,3.3.3就带有这个功能了。就是这个功能代码破坏了图片居中的设置。
维特根斯坦
2019-09-24 09:18
为什么官网的这个图片可以放大
网络语言
2019-09-22 23:32
之前是可以的,升级了到不可以了。发现插入图片代码的时候,替换了很多代码,不知道是什么意思。但是这越改越有bug,也不是个好现象。

Recommended content

article 的点点滴滴
article 文章封面
article 测试文章:5种有效的企业网站营销方法及技巧
article 测试图片上传
article 测试下文章发布
article 真的好久没有登录了,我也算是老用户了
article 测试富文本的html
article 美国80年代
article 测试
article 测试