coil-kt/coil

Placeholder image messes up image `ContentScale`

Open

#2.779 geöffnet am 7. Jan. 2025

Auf GitHub ansehen
 (3 Kommentare) (8 Reaktionen) (0 zugewiesene Personen)Kotlin (757 Forks)batch import
help wanted

Repository-Metriken

Stars
 (11.779 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 20h 14m) (28 gemergte PRs in 30 T)

Beschreibung

Describe the bug If i use placeholder then the final image does not have the correct contentScale or height, it stays the same height which the placeholder has

To Reproduce Run this code

With Placeholder

AsyncImage(
    model = "https://images.unsplash.com/photo-1595757816291-ab4c1cba0fc2?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8cmVkJTIwYmFja2dyb3VuZHxlbnwwfHwwfHx8MA%3D%3D",
    modifier = Modifier.fillMaxWidth().padding(16.dp),
    contentScale = ContentScale.FillWidth,
    placeholder = painterResource(Res.drawable.placeholder_large),
    contentDescription = "Image"
)

Expected

Achieved by removing the placeholder

AsyncImage(
    model = "https://images.unsplash.com/photo-1595757816291-ab4c1cba0fc2?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8cmVkJTIwYmFja2dyb3VuZHxlbnwwfHwwfHx8MA%3D%3D",
    modifier = Modifier.fillMaxWidth().padding(16.dp),
    contentScale = ContentScale.FillWidth,
    contentDescription = "Image"
)

Version 3.0.4

Contributor Guide