2
I have the following code that I will put below, which is responsible for taking the image that the user puts. In this case, the variable img
returns only the image url. I wanted to take the image and see which color predominates in the same.
Follows the code:
<input type="file" accept='image/*' name="imagem" id="img">
<button id="carregar" onclick="carrega()">Carregar</button>
<script type="text/javascript">
function carrega() {
var img = $('#img').val();
alert(img);
console.log('Img: '+img);
}
</script>
With the image URL, you can send a GET request to get the image itself and then do whatever processing you want on it.
– mutlei