gpt4 book ai didi

javascript - 从 Dropzone.js 获取完整尺寸图像(不是缩略图尺寸)的数据 URI

转载 作者:行者123 更新时间:2023-12-03 01:16:54 24 4
gpt4 key购买 nike

我正在使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com