百度富文本编辑器Ueditor上传图片时标签中添加宽高
ueditor.all.js中:直接搜索callback()
function callback(){
try{
var link, json, loader,
body = (iframe.contentDocument || iframe.contentWindow.document).body,
result = body.innerText || body.textContent || '';
json = (new Function("return " + result))();
link = me.options.imageUrlPrefix + json.url;
if(json.state == 'SUCCESS' && json.url) {
loader = me.document.getElementById(loadingId);
loader.setAttribute('src', link);
loader.setAttribute('_src', link); /*==================自己添加的代码====================*/
var width='';
var height='';
// 创建对象
var img = new Image();
// 设置图片的src
img.src = link;
//console.log("link:"+link);
img.onload = function(){
console.log('width:'+img.width+',height:'+img.height);
width=img.width;
height=img.height;
loader.setAttribute('width',width);
loader.setAttribute('height',height);
};
/*===================结束========================*/ loader.setAttribute('title', json.title || '');
loader.setAttribute('alt', json.original || '');
loader.removeAttribute('id');
domUtils.removeClasses(loader, 'loadingclass');
} else {
showErrorLoader && showErrorLoader(json.state);
}
}catch(er){
showErrorLoader && showErrorLoader(me.getLang('simpleupload.loadError'));
}
form.reset();
domUtils.un(iframe, 'load', callback);
}
或者自己设定大小
/*==================自己添加的代码====================*/
var width='';
var height='';
// 创建对象
var img = new Image();
// 设置图片的src
img.src = link;
//console.log("link:"+link);
img.onload = function(){
console.log('width:'+img.width+',height:'+img.height);
width=img.width;
height=img.height;
loader.setAttribute('width','340px');
// loader.setAttribute('height',height);
};
/*===================结束========================*/
或者
loader.setAttribute('width','100%');
前端显示也100%
百度富文本编辑器Ueditor上传图片时标签中添加宽高的更多相关文章
- 百度富文本编辑器UEditor安装配置全过程
网站开发时富文本编辑器是必不可少的,他可以让用户自行编辑内容的样式然后上传到后台!下面我们来介绍如何安装使用百度富文本编辑器 一.下载并且设置百度富文本编辑器的样式 你可以去百度UEditor ...
- 百度富文本编辑器ueditor使用总结
最近做的项目用到了ueditor这个东东,但是他的一些配置文档对初次使用者来说很难以理解,故作此总结 相关详细操作链接地址: http://blog.csdn.net/wusuopubupt/arti ...
- 百度富文本编辑器ueditor使用启示
百度富文本编辑器ueditor使用启示 一.总结 一句话总结:使用工具,多去看官方demo,非常详细. 二.百度富文本编辑器ueditor使用启示 官方完整demo 官方完整demo对应的源代码 &l ...
- springboot+layui 整合百度富文本编辑器ueditor入门使用教程(踩过的坑)
springboot+layui 整合百度富文本编辑器ueditor入门使用教程(踩过的坑) 写在前面: 富文本编辑器,Multi-function Text Editor, 简称 MTE, 是一 ...
- thinkphp5.1中适配百度富文本编辑器ueditor
百度富文本编辑器ueditor虽然很老,但是功能齐全,我近期需要能批量粘贴图片的功能,但是找不到,很无奈.然后现在就分享一下如何把ueditor适配到thinkphp5.1,有知道如何批量上传图片的艾 ...
- 百度富文本编辑器ueditor在jsp中的使用(ssm框架中的应用)
折腾了一下午终于把百度富文本编辑器ueditor搞定了! 项目地址:https://github.com/724888/lightnote_new 首先我参考了一个ueditor的demo ...
- Html引入百度富文本编辑器ueditor
在日常工作用,肯定有用到富文本编辑器的时候,富文本编辑器功能强大使用方便,我用的是百度富文本编辑器,首先需要下载好百度编辑器的demo, 然后创建ueditor.html文件,引入百度编辑器,然后在h ...
- Html引入百度富文本编辑器ueditor及自定义工具栏
在日常工作用,肯定有用到富文本编辑器的时候,富文本编辑器功能强大使用方便,我用的是百度富文本编辑器,首先需要下载好百度编辑器的demo, 然后创建ueditor.html文件,引入百度编辑器,然后在h ...
- Jfinal整合百度富文本编辑器ueditor
ueditor配置文件ueditor.config.js修改参数serverUrl:(改为要调用的action) 后台代码 package com.sandu.mega.admin.ueditor; ...
随机推荐
- JS add script tag to dynamically call script
//IE: var script = document.createElement("script"); script.setAttribute("type", ...
- CF501D Misha and Permutations Summation(康托展开)
将一个排列映射到一个数的方法就叫做康托展开.它的具体做法是这样的,对于一个给定的排列{ai}(i=1,2,3...n),对于每个ai求有多少个aj,使得j>i且ai>aj,简单来说就是求a ...
- HDU 1998 奇数阶魔方【模拟填数/注意边界和细节】
奇数阶魔方 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- CentOS 6.9编译安装Python-2.7.14(python升级)
参考 Python官网:https://www.python.org/ 阿里云 https://www.aliyun.com/jiaocheng/517192.html 一.查看CentOS版本和系统 ...
- 详解Swift和OC的混编
前言: 我们在一些情况下,仅仅使用swift 是无法完成一个项目的,在swift项目中必要用到 OC 实现一些功能,比如,项目要使用一些第三方的框架,但这个第三方的框架却是用 OC 实现的,或者你的项 ...
- HDU——最大连续子序列(区间DP)
上一个题的加强版! 最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- 方程式组织EQUATION DRUG平台解析(提纲) —方程式组织系列分析报告之四
https://www.bleepingcomputer.com/news/security/shadow-brokers-release-new-files-revealing-windows-ex ...
- Learn How To Attach PL/SQL Library In Oracle Forms
To attach a PL/SQL library in the Oracle Forms follow the following steps:1. Click on Attached Libra ...
- sudo如何保持当前用户的环境变量?
现象,我在/etc/profile里设置全局代理,然后使用命令 1.curl http://www.baidu.com 走代理 2.sudo curl http://www.baidu.com 并没 ...
- 社区之星礼品开箱——感谢CSDN
前言 尽管已经看过国内外无数的开箱.评測视频,也看过无数国内社区的各种玩具.电子产品.摄影的分享贴.自己却从未写过--摄影水平有限以及懒-- 昨天看到上图的文章,看到最后都说了应该晒晒照片.写写博客, ...