Answer the question
In order to leave comments, you need to log in
How to check if the user's avatar is filled without using the API?
I thought I would check by image class or url, but the class is the same for everyone, and the url is always different depending on the cdn.
https://scontent-frx5-1.cdninstagram.com/t51.2885-19/11906329_960233084022564_1448528159_a.jpg
Answer the question
In order to leave comments, you need to log in
There is such a library IM.js
There you can check the correspondence of two images pixel by pixel. Only they need to be thrown into the canvas. You can check the finished image on the server and the avatar image. If they are equal, then there is no avatar, if not, then there is an avatar.
GITHUB
From the documentation:
IM.compare([
document.getElementById("canvas_1"),
document.getElementById("canvas_2"),
document.getElementById("canvas_3"),
document.getElementById("canvas_4")
],
function success(aCanvas, nElapsedTime) {
// Code on success. All images have the same pixel info.
},
function fail(oCanvas, nElapsedTime) {
// Code on failing. Any image is different from others
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question