-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS: multiple scan does not override the first image #10
Comments
Hello my friend. I see you have raised quiet a few issues. It has been a hectic week. I will try to cover all the issues you have raised as and when I get the time to. So let me ask first, how exactly are you doing multiple scans? One ends, you use the result of that, then the next scan begins? Because in my tests, with a single scan. The image gets replaced every time I restart the scan. There is a fix, by making the name of scanned image unique, but then the problem of deleting scanned image after use comes into play. |
Hi. Absolutely no problem, I will help as much as I can. I was just playing with the awesome plugin 👍
There are two scenarios:
As far as cleanup goes, this is why things are stored in the temp dir. Otherwise the user must explicitly delete these files in a cleanup step. OR give the ability to return base64 instead of the fileUri. #someThoughts |
I've run into the same situation. I think it's linked to the way the webview is caching the file (in my case I created an HTMLImageElement and set the If that's the case the plugin could do that for you when it generates the URL... maybe using md5 instead of a timestamp? |
Did any find a good solution on this? I got same image every time? Use one button and used the timestamp |
Sorry, tested the '?' + Date.now() more correctly solved the problem |
@humblecoder so lets say you want to use an scan.scanDoc(0, onSuccess);
function onSuccess(imageURI) {
var myImage = new Image(100, 200);
myImage.src = imageURI + '?' + Date.now();
// ... do your thing with myImage
} Since all that is required by the The same solution should apply in different situations too. |
@onaluf this didn't work for me. I'm using VueJS and creating arrays of object with the
In the |
I’m not entirely sure since I don’t know VueJS but here is what I think is happening. Like said at the beginning of the thread there really only is a single image accessible at a given point in time. The solution I provided is a way to make sure that at a later time, once you captured a new image you are able to load it instead of the cached version. If you want to be able to display more than one captured document at the same time you will have to do something with those image. What I do is stamp them in a canvas:
Repeat for as many images you want but keep in mind that those url will take lot of place in memory. |
@onaluf yeah, I actually just move each file to a new |
Hey just a small update. From plugin version 4.x.x you can create files with specific filenames in ios. Just remember two things
|
Running
scan.scanDoc(1
multiple times on iOS returns the fileUri of:file:///var/mobile/Containers/Data/Application/257745E6-2D8A-41F4-8C01-6C87D4BEE540/Documents/image.png
However on multiple photos, the image.png is not overridden with the new image and always returns the first image taken.
Should each consecutive image capture rather not create a brand new file in the phone's temp directory and return it? This was multiple captures can take place at the same time and not override each other.
The text was updated successfully, but these errors were encountered: