1
I’m making an application with Vuejs and I have an image upload input and I want to set an image size limit for upload, not in KB or MB, but rather based on your pixels I mean, only allow the upload if the image respects the pixel limit.
Ex.: 320x280
If the image is larger than this it sends a warning that it cannot be images larger than the stipulated size.
Here I have the JS function that receives the image
carregarFoto (e) {
var arquivo = e.target.files
if (!arquivo[0]) {
return
}
var data = new FormData()
data.append('media', arquivo[0])
var reader = new FileReader()
reader.onload = (e) => {
this.foto = e.target.result
console.log(this.camposForm.foto)
}
reader.readAsDataURL(arquivo[0])
},
Here is the input:
<input @change="carregarFoto" type="file" name="photo" accept="image/*">
I’ve tried that one link, but it didn’t work and I’m still looking for answers, if anyone can help me I appreciate