在解决此问题之前请先备份网站数据,切记!
这次修改需要修改两个文件,增加一个文件,分别是 ↓
文件:
1. static/image/editor/editor_function.js
2. template/default/home/spacecp_blog.htm
增加的文件为:
static/image/editor/editor_function.js–复制一份,重命名为:bgeditor_function.js
编辑:editor_function.js
代码如下 | 复制代码 |
查找: function insertImage(image, url, width, heigh) { url = typeof url == ‘undefined’ || url === null ? image : url; width = typeof width == ‘undefined’ || width === null ? 0 : parseInt(width); height = typeof height == ‘undefined’ || height === null ? 0 : parseInt(height); var html = ‘<p><a href=”‘ + url + ‘” target=”_blank”><img src=”‘+image+’”‘+(width?’ width=”‘+width+’”‘:”)+(height?’ height=”‘+height+’”‘:”)+’></a></p>’; edit_insert(html); } 替换为: function insertImage(image, url, width, height,subject) { url = typeof url == ‘undefined’ || url === null ? image : url; width = typeof width == ‘undefined’ || width === null ? 0 : parseInt(width); height = typeof height == ‘undefined’ || height === null ? 0 : parseInt(height); subject = $(‘title’).value; var html = ‘<p><a href=”‘ + url + ‘” target=”_blank”><img alt=”‘+subject+’” src=”‘+image+’”‘+(width?’ width=”‘+width+’”‘:”)+(height?’ height=”‘+height+’”‘:”)+’></a></p>’; edit_insert(html); } |
再编辑bgeditor_function.js
查找:
代码如下 | 复制代码 |
function insertImage(image, url, width, heigh) { url = typeof url == ‘undefined’ || url === null ? image : url; width = typeof width == ‘undefined’ || width === null ? 0 : parseInt(width); height = typeof height == ‘undefined’ || height === null ? 0 : parseInt(height); var html = ‘<p><a href=”‘ + url + ‘” target=”_blank”><img src=”‘+image+’”‘+(width?’ width=”‘+width+’”‘:”)+(height?’ height=”‘+height+’”‘:”)+’></a></p>’; edit_insert(html); } 替换为: <blockquote><blockquote>function insertImage(image, url, width, height,subject) { |
再编辑:template/default/home/spacecp_blog.htm
查找:
editor_function.js
替换为:
bgeditor_function.js
编辑完毕保存,把文件上传到原来位置,增加的bgeditor_function.js与editor_function.js一块放在同一目录。
后台发布一片文章,输入文章标题,上传图片,进入源代码模式,看看图片是不是有了alt标签?
时间: 2024-09-21 22:59:10