Hi how to load image bitmap in kamel image
# multiplatform
h
Hi how to load image bitmap in kamel image
🧵 1
v
So... This is pretty close to the "large stack traces" comment. Please remove the code from the initial message and add it as a (well formated) message in a thread reply to your inital message
h
sample code :
fun CustomImageContainer(
urlImage:String, modifier: Modifier, image:ImageBitmap? = null ){ Box( modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center ) { Card( colors = CardDefaults.cardColors(containerColor = mediumGrey), border = BorderStroke(superDuperSmallPadding, lightGrey), modifier = modifier, shape = CircleShape ) { if(image != null){ Image(image, contentDescription = null, contentScale = ContentScale.Crop) } KamelImage( resource = if(image != null){ asyncPainterResource(image) } else{ asyncPainterResource(urlImage) } , onLoading = { CustomImage( painterResource(Res.drawable.image_holder), Modifier .align(Alignment.Center) ) }, onFailure = { CustomImage( painterResource(Res.drawable.image_holder), Modifier .align(Alignment.Center) ) }, contentDescription = null, contentScale = ContentScale.None, modifier = Modifier.fillMaxSize(), animationSpec = tween() ) } } }
🙌 1