Since ExecuteCallback
is not available anymore, what's the equivalent to the code below?
#1312
-
var originalImageHeight by remember { mutableStateOf(0f) } // px
var originalImageWidth by remember { mutableStateOf(0f) } // px
Image(
painter = rememberImagePainter(
data = url,
builder = {
listener(
onSuccess = { _, _ ->
isLoading = false
},
onError = { _, _ ->
isLoading = false
}
)
},
onExecute = { _, current ->
originalImageHeight = current.size.height
originalImageWidth = current.size.width
true
}
),
// ...
) |
Beta Was this translation helpful? Give feedback.
Answered by
colinrtwhite
Jun 14, 2022
Replies: 1 comment
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
colinrtwhite
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
current.size
is not the original size of the image - it's the size returned fromSizeResolver.size
. It's currently not possible to get the image's original size from Coil'sImageResult
. You could theoretically parse it yourself by setting a customDecoder.Factory
, parsing theImageSource
then returningnull
so the next decoder performs the decode.