【原创】教你如何将DZ门户文章图片自动居中且自动加上标题为图片alt标签、title标签-Discuz教程下载

【原创】教你如何将DZ门户文章图片自动居中且自动加上标题为图片alt标签、title标签

开通本站Svip会员,全站资源免费下
效果如下:
1.png

教程开始:
1、进入网站根目录——static——image——editor——复制一份editor_function.js文件并重命名为bgeditor_function.js
2、打开editor_function.js文件搜索代码
  1. function insertImage(image, url, width, height) {
复制代码
将代码
  1. function insertImage(image, url, width, height) {
  2.         url = typeof url == 'undefined' || url === null ? image : url;
  3.         width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
  4.         height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
  5.         var html = '<p><a href="' + url + '" target="_blank"><img src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
  6.         edit_insert(html);
  7. }
复制代码
修改为
亲爱的游客您好,请 登录 后进行 回复
3、打开bgeditor_function.js文件搜索代码
  1. function insertImage(image, url, width, height) {
复制代码
将代码
  1. function insertImage(image, url, width, height) {
  2.         url = typeof url == 'undefined' || url === null ? image : url;
  3.         width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
  4.         height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
  5.         var html = '<p><a href="' + url + '" target="_blank"><img src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
  6.         edit_insert(html);
  7. }
复制代码
修改为
亲爱的游客您好,请 登录 后进行 回复
4、打开 bgeditor_function.js 进行编辑,通过 CTRL+F 查找以下的代码:
  1. function insertImage(image, url, width, height, subject) {
复制代码
将这段代码替换成以下的代码:
  1. <blockquote><blockquote>function insertImage(image, url, width, height, subject) {</blockquote></blockquote>
复制代码
5、进入网站根目录——template——default或当前使用模板——home——打开 spacecp_blog.htm文件
查找:editor_function.js修改为bgeditor_function.js 保存后更新后台缓存。
【教程提醒:对以往已发布的文章图片不会生效,必须是根据教程修改后新发布的文章图片后有效,如希望以前图片也可生效请自行对以往文章的图片删除重新上传图片即可】
懒人包如下:(下载后直接上传到网站根目录替换即可)
亲爱的游客您好,请 登录 后进行 回复
特别说明:如使用第三方模板自带spacecp_blog文件,请在自带的文件中自行添加如下代码
  1. <script type="text/javascript" src="{STATICURL}image/editor/bgeditor_function.js?{VERHASH}"></script>
复制代码

如不会处理可联系站长QQ:3197813386 (收费50元/次)


完美配套教程
【原创】DZ门户文章每段文章自动空两格且图片自动居中
【原创】Discuz门户文章实现图片增加alt标签并自动居中,点击图片放大,再次点击图片则恢复原样

相关教程:
【原创】修改DZ门户文章默认字体大小及颜色。
【原创】教你如何将DZ门户文章图片自动居中且自动加上标题为图片alt标签、title标签
【原创】如何给DZ门户文章内容页的标题添加当前文章链接
【原创】教您如何修改DZ论坛帖子的图片自动居中,无需自行设置居中
【原创】教您如何让上传的帖子图片自动加上帖子标题,让搜索引擎读取图片内容说明
【原创】手把手教您如何删除鼠标指向图片出现的上传,下载附件等表框



全部评论 0

您需要登录后才可以回帖 立即登录
登录
0
0
0
返回顶部