How to create a round image in Elm-UI?

Hello

Some weeks ago I wrote a question on stackoverflow about how to display a round image in Elm-UI.
Sadly nobody could help me there, so i try i here again. :smiley:

The task is fairly easy I think. I got a url to an image and I want to display it round - like here in the elm disourse forum.

Can someone help me to achieve that?
Greetings!

U can use “Border.rounded yourValue”
And depending on how you do it maybe “clip” as well to not show overflowing content. But I do not think this is normally needed for what you are trying to do.
If you set the rounded value very large, it becomes round. To get anperfect circle like here, your image must be same height/width.

So currently I´ve got that:

image
    [ centerX
    , Border.rounded 50
    ]
    { src = "https://whatever.com/link-to-a-sample-image.jpg"
    , description = "a sample image"
    }

Adding the suggested Border.rounded did not change anything.

Ok… seems like clip is also needed in this case:

image
            [ centerX
            , centerY
            , Border.rounded 50 
            , clip
            ]
            { src = "https://cdn.cnn.com/cnnnext/dam/assets/191024091949-02-foster-cat-large-169.jpg"
            , description = "A Cat"
            }

Working Ellie-example here

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.