Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use auto height #73

Closed
dbotman opened this issue Mar 20, 2022 · 3 comments
Closed

Use auto height #73

dbotman opened this issue Mar 20, 2022 · 3 comments

Comments

@dbotman
Copy link

dbotman commented Mar 20, 2022

Hello @dev-yakuza,

Is there an option or what is the best way to use auto height ?
We want to show the image at 100% width with height based on the image.

@dev-yakuza
Copy link
Owner

Hi, @dbotman

Is there an option or what is the best way to use auto height?

I'm sorry that this library doesn't support the auto height option. 😭

I think you can make it with the Image.getSize.

@dbotman
Copy link
Author

dbotman commented Mar 21, 2022

Hi @dev-yakuza,

Thanks for your answer.

Correct me if i'm wrong, when you use Image.getSize before loading the Image Modal then you download the picture twice.
I am already using this at the moment. I'm see a longer loading time of the pictures when using Image.GetSize before.
When i test with a fixed size the images loading faster.

@dev-yakuza
Copy link
Owner

Hi @dev-yakuza,

Thanks for your answer.

Correct me if i'm wrong, when you use Image.getSize before loading the Image Modal then you download the picture twice. I am already using this at the moment. I'm see a longer loading time of the pictures when using Image.GetSize before. When i test with a fixed size the images loading faster.

Hi, @dbotman

According to the document,

In order to retrieve the image dimensions, the image may first need to be loaded or downloaded, after which it will be cached. This means that in principle you could use this method to preload images, however it is not optimized for that purpose, and may in future be implemented in a way that does not fully load/download the image data. A proper, supported way to preload images will be provided as a separate API.

To get the size, the image is downloaded, and if you want to prevent downloading the image multiple, you can preload the image.

So, I think you can preload the image by the prefetch() and then, get the size of the image, and display it with the size. Have you ever tried this one? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants