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
Thumbnail images #168
Comments
Hey there, this is a useful addition to the library and I would be happy to take PR's solving the problem of resizing the images (or retrieving at a smaller size). |
I agree this is a must to have for such library and solution based on generating the thumbnail are not good for performance. I looked into it a little bit, for Android we could use: https://developer.android.com/reference/android/provider/MediaStore.Images.Thumbnails.html It's deprecated starting from API Level 29 but it's available from API Level 1. For iOS it looks like PHCachingImageManager should be used |
@bartolkaruza @noobvim I am trying to look into this improvement, I tried several methods to generate or get existing thumbnail (only in Android and for images, for now): Performance are observed on Xiaomi Mi A1.
Given that I not sure how to easy drop those down, I am wondering if makes more sense having a separate I can also try to optimise by trying to get all thumbnails with one single query/cursor, aggregating first mediaId then try to query once by filtering for those id. This might drop latency in Android but I still not sure about iOS implementation. |
I really like the I suppose it will be a much simpler implementation for the actual retrieval of the thumbnails, at the cost of potentially duplicating some of the logic between |
I think that |
I agree that the API would be nicer to add them to @gran33 we've had a lot of performance complaints when adding similar resource consuming features on this method, like this one: #175 I'd rather not go in a circle of adding the feature then removing it behind a flag again later, can you understand this point of view? |
@gran33 I agree having in getPhotos would be better but performance-wise is not a good idea. @bartolkaruza I might coming back to this. A
allowNetworkAccess might be useful in iOS as the API that we can use has this flag, and you might want to deny to go to cloud to generate the thumbnail, if the photo is on iCloud, device should still have some small representation locally. targetWidth and targetHeight because on iOS or in general the API might not return exact size but something closer to what you request. Quality is jpeg quality to eventually compress if you want a lighter Additionally, in iOS PHCachingImageManager exists to optimise fetching of multiple assets (useful when you render the gallery in a grid): https://developer.apple.com/documentation/photokit/phcachingimagemanager
So we can warm-up the PHCachingImageManager when this parameter is populated in iOS, so consequent getPhotoThumbnail might already have the image cached if requested with the same ThumbnailSize. What do you think? |
@dokkis Any updates on thumbnail part ? |
I'm having the same problem, the images load slowly even just only 100 :D. It takes like 2-3 seconds. It is sad. |
For those who need a quick production fix, you can use const { assets } = await MediaLibrary.getAssetsAsync()
<Image source={{ uri: asset[0].uri }} />
// for full (downloaded) image, you can use assetWithInfo.localUri
const assetWithInfo = await MediaLibrary.getAssetInfoAsync(asset[0].id) expo/expo#8541 (comment) I think, for API, we can use |
any updates on this feature?, i think this will be great feature for render camera roll photo in a grid (very popular case). |
@bartolkaruza If eventually I work on a PR for such a feature, would you be ok to merge it into this library? (Just to be sure I don't work for nothing 😀) |
Hi @PierreCapo! @bartolkaruza is currently not an active maintainer. Me and some others are now the active maintainers. Thanks for working on this! |
Awesome, thanks for your fast response 👍 |
@PierreCapo Thumbnail for videos too would be appreciated |
@Arjan-Zuidema I am unable to get Video from the device, only Photos. Even if I set |
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This issue was closed because it has been stalled for 10 days with no activity. |
I created a PR (536) to add a @bartolkaruza want to take a look? |
Hi @jp-23 I will take a look at the end of the week. Sorry, really busy now :) |
Hi, this package is unusable if someone wants to implement their own camera roll because the image sizes returned are huge, causing a very noticeable sluggish performance degradation when loading lots of images into FlatList. It would be great to have smaller thumbnail image sizes returned in addition to the regular full size images. Thanks!
react-native-image-resizer is not a valid workaround since it takes a long time to process images.
Similar to #110
The text was updated successfully, but these errors were encountered: