gpt4 book ai didi

javascript - Dropzone 缩略图宽度图像大小

转载 作者:太空狗 更新时间:2023-10-29 13:21:49 47 4
gpt4 key购买 nike

如何更改上传图片的缩略图大小?我在我的 javascript 中尝试过 thumbnailWidth:"350",但这并没有增加缩略图的大小,缩略图只是看起来放大了。我该如何处理图像缩略图的大小?

HTML:

<section id="create">
<form action="upload.php" class="dropzone" id="uploadphoto"></form>
</section>

CSS:

.dropzone {
position: relative;
border: 10px dotted #FFF;
border-radius: 20px;
color: white;
font: bold 24px/200px arial;
height: 400px;
margin: 100px auto;
text-align: center;
width: 400px;
}

.dropzone:hover {
border: 10px dotted #0C3;

.dropzone.dropped {
background: #222;
border: 10px dotted #444;
}

.dropzone.in {
width: 600px;
height: 200px;
line-height: 200px;
font-size: larger;
}

.dropzone img {
border-radius: 10px;
vertical-align: middle;
max-width: 95%;
max-height: 95%;
}

Javascript:

Dropzone.options.uploadphoto = {
maxFilesize: 25, //MB
dictDefaultMessage: "Drag and Drop Posters or click",
acceptedFiles: ".jpeg,.jpg,.png,.gif,.JPEG,.JPG,.PNG,.GIF,.pdf,.pub",
thumbnailWidth:"350",
accept: function(file, done) {
console.log("uploaded"); //debuging the upload
done();
},
init: function() {
this.on("addedfile", function() {
if (this.files[1]!=null){
this.removeFile(this.files[0]);
}
});
}
};

最佳答案

使用您在配置选项中使用的相同值覆盖 CSS

.dropzone .dz-preview .dz-image {
width: 250px;
height: 250px;
}


Dropzone.options.myAwesomeDropzone = {
....
thumbnailWidth: 250,
thumbnailHeight: 250,
....
}

参见 JS Fiddle here

关于javascript - Dropzone 缩略图宽度图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28031705/

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