Skip to content

Possible to use temporary model #2882

Closed Answered by Eightyplus
Eightyplus asked this question in Q&A
Discussion options

You must be logged in to vote

I solved this by using coil and LaunchedEffect by this link: https://dev.to/erselankhan/image-url-to-bitmap-using-coil-in-jetpack-compose-erselan-khan-1dc5

Anyone interested in the implementation details:

@Composable
private fun ThumbnailWithScrubCache(
    imageUrl: String,
    modifier: Modifier,
    width: Int,
    height: Int,
) {
    val context = LocalContext.current
    val scope = rememberCoroutineScope()

    var imageBitmap by remember { mutableStateOf<ImageBitmap?>(null) }
    LaunchedEffect(imageUrl) {
        urlToBitmap(
            scope,
            imageURL = imageUrl,
            context = context,
            onError = { error ->
                Timber.i(error, "Error l…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Eightyplus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant