jquery - plupload:上传前验证图像尺寸?
问题描述
我检查了文档但找不到任何东西.. 有没有办法在上传之前验证文件的图像尺寸?我想为最小图像尺寸添加一条规则,并在图像太小时显示错误消息。
解决方案
好的,我可以自己找到它:
把它放在FilesAdded
函数里面:
plupload.each(files, function(file, i)
{
var img = new mOxie.Image;
img.onload = function () {
var wi = this.width;
var he = this.height;
// you can validate here
};
img.load(file.getSource());
});
推荐阅读
- selenium - Selenium WebDriver 消耗 19,000 MB 内存。启动 Firefox 需要 10 分钟
- javascript - ReactJS错误TypeError:无法将未定义或空值转换为对象
- c# - 使用 Quartz.Net 在未指定的时间执行作业
- css - 定位元素垂直响应图像
- python - 获取 Excel 图表详细信息到 Python
- javascript - 如何链接 axios HTTP 请求
- javascript - 如何删除地图框标记
- react-native - 为在同一网络上的 Windows 计算机上运行的 Expo 项目执行 iOS 模拟器
- python - 如何覆盖列表?
- prometheus - 使用 Prometheus 作为 Infrastructure 日志存储