作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Dropzone.js 上传图像。当图像上传并检查它时,它给了我这个-
<img data-dz-thumbnail="" alt="AJ-Styles-WWE-2K19-cover-e1533698368369 (1).jpg" src="the_Data_URI">
将鼠标悬停在 src 部分上会显示图像为 120 X 120 像素,而实际图像为 800 X 450 像素。
我需要对 Dropzone 进行哪些更改才能上传原始大小的图像而不是缩略图大小。
最佳答案
回调函数如下所示-
Dropzone.options.myDropzone = {
url: "UploadImages",
thumbnailWidth: null,
thumbnailHeight: null,
init: function() {
this.on("thumbnail", function(file, dataUrl) {
$('.dz-image').last().find('img').attr({width: file.width, height: file.height});
})
}
};
html 正文中的表单标记-
<form action="UploadImages" class="dropzone" id="myDropzone" enctype="multipart/form-data"></form>
在这部分回调中,宽度属性设置为file.width,高度设置为file.height(这实际上解决了问题)-
$('.dz-image').last().find('img').attr({width: file.width, height: file.height});
现在上传的图像采用原始尺寸,而不是默认的 120 X 120 像素缩略图。
关于javascript - 从 Dropzone.js 获取完整尺寸图像(不是缩略图尺寸)的数据 URI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51972058/
我有一个具有可变数量子元素的固定大小的 div。我不知道 children 的大小。目标是缩小它们以适合父级。 例子: .parent { width: 100px; height: 100p
我是一名优秀的程序员,十分优秀!