Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Show images on RichText without setting width and height #336

Closed
Philio opened this issue Aug 30, 2024 · 7 comments · Fixed by #343
Closed

Show images on RichText without setting width and height #336

Philio opened this issue Aug 30, 2024 · 7 comments · Fixed by #343
Labels
enhancement New feature or request

Comments

@Philio
Copy link

Philio commented Aug 30, 2024

With a simple sample such as:

val richTextState = rememberRichTextState()
LaunchedEffect(html) {
    richTextState.setHtml(html)
}
RichText(
    state = richTextState,
    modifier = Modifier.fillMaxSize(),
    imageLoader = Coil3ImageLoader
)

The HTML is rendered, but images aren't loaded

@MohamedRejeb MohamedRejeb added the question Further information is requested label Sep 21, 2024
@Philio
Copy link
Author

Philio commented Sep 21, 2024

Hey, thanks for getting back to me

Coil has been working fine with the default image loader, but we've tried adding a custom one and the problem still persists

For example, the HTML returned from the API is:

<p>A random image of some sheep...</p><p></p><p><img src="https://storage.googleapis.com/boxes-public-content-preview/0191a2bb-8415-7247-a562-df821cc73133-small"></p>

Coil is loading it...

💾 Successful (DISK) - https://storage.googleapis.com/boxes-public-content-preview/0191a2bb-8415-7247-a562-df821cc73133-small

But it's not being rendered:

Screenshot_20240921_132535

@MohamedRejeb
Copy link
Owner

MohamedRejeb commented Sep 21, 2024

Currently, only images with fixed width and height can be shown, something like this should work:

<p>A random image of some sheep...</p><p></p><p><img src="https://storage.googleapis.com/boxes-public-content-preview/0191a2bb-8415-7247-a562-df821cc73133-small" width="100", height="100"></p>

I will work on getting the image's width and height by default.

@MohamedRejeb MohamedRejeb changed the title Coil image loading doesn't seem to be working Show images on RichText without setting width and height Sep 21, 2024
@MohamedRejeb MohamedRejeb added enhancement New feature or request and removed question Further information is requested labels Sep 21, 2024
@Philio
Copy link
Author

Philio commented Sep 21, 2024

Thanks! Will see if we can manipulate the HTML content in the backend to populate width/height and give it another try

@MohamedRejeb
Copy link
Owner

It will be available in the next release soon.

@MohamedRejeb
Copy link
Owner

Try the new version v1.0.0-rc07, it should be working fine now.

@Philio
Copy link
Author

Philio commented Sep 21, 2024

Works like a charm, thanks for sorting it!

Screenshot_20240921_172700

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants