Comments (10)
Images are stored as files on Android and iOS. If a user deletes the app, the files get deleted.
You can store them somewhere else like S3 if you want, and you can delete them manually.
from react-native-document-scanner-plugin.
@dmarcs i would like to delete scans that i have processed, but with expo filesystem i cannot do it.
How do I delete scans that I no longer need? I don't want to bloat memory with unneccessary images.
from react-native-document-scanner-plugin.
@dmarcs i would like to delete scans that i have processed, but with expo filesystem i cannot do it. How do I delete scans that I no longer need? I don't want to bloat memory with unneccessary images.
I also have the same problem, the image files after scanning are not automatically deleted causing the memory to be full.
using expo-file-system cannot delete them.
have you solved it yet?
from react-native-document-scanner-plugin.
@hm1061998 not really, i saw that expo-media-library should do the trick because it can access camera roll folder (i didnt try it yet), but the path to the file is in the scope of the app if i understand it right, so expo-file-system should work.
Anyway, for now I am waiting for @dmarcs to answer it.
(and i hope there is a way to delete it, otherwise i dont know what will i do :D)
from react-native-document-scanner-plugin.
@hm1061998 @eduardfarkas can't you use https://docs.expo.dev/versions/latest/sdk/filesystem to delete the files?
from react-native-document-scanner-plugin.
It says that the file is not deletable. I have tried to modify the path a little bit just in case it was wrong but i had no success.
I would like to ask you to try to reproduce it on your end. I tried it on android simulator on macos.
from react-native-document-scanner-plugin.
I was able to delete files using https://www.npmjs.com/package/react-native-fs.
from react-native-document-scanner-plugin.
@dmarcs sorry for delay, i tried this library https://github.com/DylanVann/react-native-fast-image and i was also able to delete the image.
I suggest putting this information in the readme so other users will be aware that images must be deleted with external library.
btw, thank you for trying it yourself
from react-native-document-scanner-plugin.
@dmarcs sorry for delay, i tried this library https://github.com/DylanVann/react-native-fast-image and i was also able to delete the image. I suggest putting this information in the readme so other users will be aware that images must be deleted with external library. btw, thank you for trying it yourself
How did you do that ? Can you show code examples ?
import FastImage from 'react-native-fast-image'
import DocumentScanner from 'react-native-document-scanner-plugin'
export default () => {
const [scannedImage, setScannedImage] = useState();
const scanDocument = async () => {
const { scannedImages } = await DocumentScanner.scanDocument()
if (scannedImages.length > 0) {
setScannedImage(scannedImages[0])
}
FastImage.clearMemoryCache() <<< Did you delete the image by adding this line ?
}
useEffect(() => {
scanDocument()
}, []);
return (
<FastImage
style={{ width: 200, height: 200 }}
source={{
uri: scannedImage,
priority: FastImage.priority.normal,
}}
resizeMode={FastImage.resizeMode.contain}
/>
)
}
from react-native-document-scanner-plugin.
Hi @silencie,
sorry for the trouble, I definatelly meant to link different library. react-native-fast-image is not meant to handle this.
I am using react-native-file-access
Here is code snippet i use:
import { FileSystem } from "react-native-file-access";
const deleteImageFromMemory = (path: string) => {
FileSystem.exists(path).then((exists) => {
exists && FileSystem.unlink(path).then((result) => {});
});
};
from react-native-document-scanner-plugin.
Related Issues (20)
- [Unhandled promise rejection: Error: The package 'react-native-document-scanner-plugin' doesn't seem to be linked. Make sure: HOT 1
- Option to enable flash and disabled front camers
- feature request: return the detected texts in the scanned document. HOT 1
- No document edges are detected HOT 1
- Camera on IOS is more zoomed in than default IPhone camera HOT 1
- Access the image cropping functionality without using the camera. HOT 1
- Apk and AAB Size Increases by 50% HOT 4
- I want to cache images HOT 1
- i want to fix the camera interface and want to catch button events HOT 1
- Camera is not opening in Android below 11 HOT 1
- REMOVE AUTO CROPPING / DISABLE DOCUMENT BORDER DETECTION HOT 1
- Will there ever be support for Expo GO?
- ImageUtil.getImageMatrixFromFilePath ava.lang.NullPointerException - Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference HOT 4
- [iOS] "RNPdfScanner" was not found in the UIManager. HOT 1
- ANDROID BUILD FAILED HOT 11
- preview document detection in android HOT 1
- Document cropper background is white on IOS HOT 1
- Add Media Library Support for Document Scanning and Cropping HOT 5
- The package 'react-native-document-scanner-plugin' doesn't seem to be linked. HOT 1
- Crash when trying to resume activity HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-document-scanner-plugin.