coil-compose not loading file as image
See original GitHub issueDescribe the bug
I have a Java File , which is an image , which was working fine with accompanist version of the library but as soon as I upgraded , Those image files are not being displayed even though they present inside the storage
I created these files using context.openFileOutput(id, Context.MODE_PRIVATE)
Now I am loading them as File objects since they were saved by the user previously
The images are not showing , not even an empty box , Even though rememberImagePainter
is being used , The state does not have any error as well
I am also supplying a loader since some images might be an svg
val loader = remember {
ImageLoader.Builder(context).componentRegistry {
add(SvgDecoder(context))
}.build()
}
val painter = rememberImagePainter(data = request, imageLoader = loader)
Image(
modifier = modifier,
painter = painter,
contentDescription = stringResource(R.string.random_image),
contentScale = contentScale
)
Checking for an error like this
if (painter.state is ImagePainter.State.Error) {
LaunchedEffect(key1 = painter.state, block = {
Log.e(
"TL_AttachmentPhotoImage",
"Error Loading Image With Request : " + request.toString() + " , isSvg : " + isSvg.toString()
)
})
}
Expected behavior The Images should load and show properly
To Reproduce Use context.openFileOutput to create and save an image load The Image using a file object as a data in the Image Painter
Logs/Screenshots no logs
Version “io.coil-kt:coil-compose:1.3.0”
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
This sounds related to the way
rememberImagePainter
handles undefined constraint vs. how Accompanist handled it. Try settingModifier.size(128.dp)
(or another size) on theImage
composable.Going to close this out, but feel free to create a new ticket if you’re able to create a sample that reproduces the issue.
Actually there are no logs from image loader , I was using accompanist painter and got success logs but in coil painter there is not a single log