Skip to content

Loading an image from a URL for ImageNode() #523

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

You must be logged in to vote

As a workaround you can use a Image-Loading Library. For example Glide

App-Gradle

implementation("com.github.bumptech.glide:glide:4.16.0")
private fun addImageNode(anchor: Anchor) {
        Glide
            .with(this)
            .asBitmap()
            .load("https://upload.wikimedia.org/wikipedia/commons/0/01/Cat-1044750.jpg")
            .fitCenter()
            .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
            .apply(RequestOptions.timeoutOf(5 * 60 * 1000))
            .into(object : CustomTarget<Bitmap>(){
                override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
                    val imageNode = ImageNode(
                   …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ThomasGorisse
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #521 on June 11, 2024 12:54.