Uedior在上传图片的生活,需要自动设置上传图片的宽度或高度属性。该方法只能用于多图上传组件,单图上传无法使用。

该方法基于 ueditor 1.4.3 版本制作:

1.添加属性字段,在config.json文件中:

/* 上传图片配置项 */字段下添加:
    "imageWidth": 700, /* 上传图片宽度指定, 1.4.3官方版本无此参数,自行添加*/
"imageeight": 700, /* 上传图片高度指定, 1.4.3官方版本无此参数,自行添加*/
"imageSide": 1, /* 多图上传图片尺寸设置方式,0为不指定,1为按照宽度,2为按照高度,3为同时指定 1.4.3官方版本无此参数,自行添加*/

2.修改插入图片js语言逻辑,在image.js文件中:

UploadImage中:
getInsertList: function ()(约:L774)
        getInsertList: function () {
var i, data, list = [],
align = getAlign(),
prefix = editor.getOpt('imageUrlPrefix');
for (i = 0; i < this.imageList.length; i++) {
data = this.imageList[i];
var temp = {};
temp["src"] = prefix + data.url;
temp["_src"] = prefix + data.url;
temp["title"] = prefix + data.title;
temp["alt"] = prefix + data.original;
temp["floatStyle"] = prefix + data.align;
if (editor.getOpt('imageSide')==1||editor.getOpt('imageSide')==3)
temp["width"] = editor.getOpt('imageWidth');
if (editor.getOpt('imageSide')==2||editor.getOpt('imageSide')==3)
temp["height"] = editor.getOpt('imageHeight');
list.push(temp); // list.push({
// src: prefix + data.url,
// _src: prefix + data.url,
// title: data.title,
// alt: data.original,
// floatStyle: align
// });
}
return list;
}

PHP7.0+Ueditor1.4.3实测通过。

Ueditor 自动设置上传图片的宽度或高度的更多相关文章

  1. jQuery获取或设置元素的宽度和高度

    jQuery获取或设置元素的宽度和高度: 可使用以下3种方法: 1,jQuery width() 和 height() 方法: 2,innerWidth() 和 innerHeight() 方法: 3 ...

  2. 如何使用代码动态的获取和设置ImageView的宽度和高度?

    http://blog.csdn.net/wulianghuan/article/details/8644144 国内某金融企业的一道面试题:如何在代码中获得一个ImageVIew的高度和宽度? 相信 ...

  3. imageView--转-如何代码动态的获取和设置ImageView的宽度和高度?

    11- 12- 13-android获取图片原始长宽; ========= 11--国内某金融企业的一道面试题:如何在代码中获得一个ImageVIew的高度和宽度? 相信很大一部分人,会直接想到用im ...

  4. Cocos Creator 动态设置Canvas的宽度与高度,更改适配

    let c = this.node.getComponent(cc.Canvas);c.fitHeight = true;c.fitWidth = false; let h = 960 * cc.wi ...

  5. 在js中获取上传图片的宽度和高度

    Html: <input type="file" id="MapUploadTd" onchange="getMapPictureSize(th ...

  6. EasyUI设置Layout自适应浏览器宽度和高度

    //设置自适应浏览器宽度和高度 function setLayoutHeight() { var height = $(window).height() - 20; $("#main_lay ...

  7. 自动设置iframe大小的jQuery代码

    自动设置iframe的宽度,如何用jquery来实现呢? 代码: <iframe src="main_folder.aspx" class="global_main ...

  8. 百度的富文本编辑器UEditor批量添加图片自动加上宽度和高度的属性

    若是没有对编辑器做任何配置直接添加图片的话,显示的html内容如下图所示:它会显示出原图片尺寸 所以必须要对图片的初始显示尺寸做控制:ueditor文件中找到image.js文件 在image.js中 ...

  9. 有两种分别用<bgsound>和<embed></embed>标签,当用<embed>插入背景音乐时可以设置宽度和高度为0,隐藏播放器。

     <bgsound>: <bgsound> 是用来插入背景音乐,但只适用于 ie,其参数设定不多.如下 <bgsound src="your.mid" ...

随机推荐

  1. IOCP另一种实现

    参考 https://docs.microsoft.com/zh-cn/windows/win32/api/winbase/nf-winbase-bindiocompletioncallback ht ...

  2. Leetcode 5274. 停在原地的方案数

    纪念第一次正式参加,听说这次题目很水,感觉确实不是很难,一般前两题都很简单,这次,到第三题的时候,都还可以做,emm...... 实际代码记录: #include <iostream> # ...

  3. vux scroller在iOS13上,一停止滑动就跳到顶部

    转载:https://blog.csdn.net/sllailcp/article/details/102502452 今天客户反馈的问题,说在最新版的iOS上(iOS13),滑动列表,滑完就会跳到顶 ...

  4. cad.net 块裁剪边界反向修剪

    Querying for XCLIP information inside AutoCAD using .NET  这里下面观众讨论了 How do I determine if an x-clip ...

  5. (转)MyBatis传入多个参数的问题

    背景:记录mybaitis的使用方法,博闻强记,后面尽量记忆使用. MyBatis传入多个参数的问题 MyBatis传入多个参数的问题 详细记录mybatis在传递多个参数时候的使用方法 关于Myba ...

  6. mySql使用手册-官方文档

    https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format oracle to_ ...

  7. php开始,html应用的一些不错收藏

    来源:http://happymc.iteye.com/link?tag=%E4%B8%AA%E4%BA%BA%E6%94%B6%E8%97%8F%E7%9A%84%E5%A5%BD%E7%BD%91 ...

  8. Golang解析、验证、修改URL之Host、Port、Path

    URL解析验证问题 net.ParseIP()只能解析不带冒号以及端口号的IP4/IP6 ✔: 127.0.0.1.2001:db8::68 ✖: 127.0.0.1:8080.www.baidu.c ...

  9. HTML5 Canvas实战之刮奖效果【转】

    开源项目地址:https://github.com/artwl/Lottery 作者博客地址:http://www.cnblogs.com/jscode/p/3580878.html 谢谢浏览!

  10. NET Core 导入web.config配置文件

    1.首先需要在NET Core项目中引入System.Configuration.ConfigurationManager,它可以读取web.config中的相关配置信息. 2. 将web.confi ...