https://kotlinlang.org logo
Title
m

MaxUt

08/10/2021, 8:17 AM
Is there a way to load local images stored in /data with Coil ? I've been using Glide so far but it is now deprecated and I'm trying to figure out an alternative.
c

Colton Idle

08/10/2021, 8:21 AM
It seems like coil can load local images according to docs
// URL
imageView.load("<https://www.example.com/image.jpg>")

// Resource
imageView.load(R.drawable.image)

// File
imageView.load(File("/path/to/image.jpg"))

// And more...
m

MaxUt

08/10/2021, 8:30 AM
Thanks a lot @Colton Idle, by casting my path into a File object it's working 🙂
Image(
    painter = rememberImagePainter(File(imageUrl)),
    contentDescription = "",
)
👍 1