Once encountered a demand, the user took identity card upload verification,
Then I got stuck at the photo shoot.
Originally adopted is the Api,wx.chooseimage,
But then it turns out that a URL format that only can be previewed is returned.
But the verification is to be placed on the PC, it is equal to save the URL can not see it.
And then looked at the document in detail, it looked as if it could be uploaded first and then downloaded locally.
The other two api,wx.uploadimage and Wx.dowmloadimage were also opened with a spit groove.
Never thought, the end is, Chooseimage get localids then uploadimage get ServerID, then downloadimage and become localid.
Think about it, maybe this is not a problem with browser permissions, so find the back end to discuss this issue.
Only know, downloadimage backstage personnel to go down, the specific reason he didn't say understand ...
Well, it's a walk-through. Photo and upload verification this process.
However, when I was ready for a moment of joy, the colleague at the table told me that
Just tried it, as if input[type= "file"] seems to be on the phone photo selection room will be more than a photo button.
Then I tried, the days of chatter, in the heart of a NMP do not know when speaking improper, above the API this road and pit and trouble good felling.
However, while I was ready for a moment of joy, another colleague told me that
Just tried it, like my cell phone is not good,
And then focus on a lap, there are some mobile phones only select the picture is not photographed this option, such as Xiaomi 3/Huawei Mate7.
Pull cold pull cool, web standards is how important ah ...
So the project has to choose the API this way,
A little glad that the customer base is good platform-based, otherwise it has to be changed into WebApp.
And as time goes by,
Find a way to turn on your phone camera (for a fake AR) on GitHub recently, looking for Mac compatible Getusermedia.
has been no fruit, so I reported to the big guy, who knows after he gave me a camera API.
Tried, in fact, is an open camera function, but this jumped out of the browser, can not add things into AR ah.
But suddenly thought, may be able to solve the last part of the mobile phone can not take pictures of the problem, went to see the next source.
Can't help but all the face, everything because accept= "image/*" this attribute!
<input type= "File" > <!--Some phones do not have a camera option--><input type= "file" accept= "image/*" > <!--have-- >
A moment old, can not help smile, feel the years to get people, maybe this is the life of the programmer.
However! This story is not finished!!!
accept= "image/*" can't use FileReader,
Use window only. URL of the Createobjecturl,
It also means that it returns a BLOB-type URL that cannot be previewed on other pages.
Finally, unexpectedly still can only go the API this road, not reconciled, waiting to continue to look for ....
Case of input
Https://foreverz133.github.io/demos/single/input-file.html
Case (of course you can only see the effect, the code in Common.js)
Http://goldcard.kdcer.com/User/BindingProcessStep2
Well, go a lot of detours, and everyone with the progress, what is the DA
Input-file Some phones can't take pictures.