'nextJs set Image to auto height
My problem with Image component from Next.js
I receiving from api urls to images with different resolution.
imageContainer have width to 100% and I want to force the images to take the necessary height auto.
For the moment I use this solution:https://dev.to/tanahmed/next-image-make-image-fill-available-space-272o
However, I believe that this is not the correct approach because it is not the solution envisaged by the nextJS developers
I have searched for a solution but most solutions force you to know the width and height which I do not know.
I am also not able to specify the height of the container permanently, it must be automatic
Fill property is not a solution because i do not know height of container.
Solution 1:[1]
Check re.findall() documentation, you will see that it returns a list!
Taking a look into its source code:
def findall(pattern, string, flags=0):
"""Return a list of all non-overlapping matches in the string.
If one or more capturing groups are present in the pattern, return
a list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result."""
return _compile(pattern, flags).findall(string)
That's why you can't cast x to float!
In doubt, you can check its type:
print(type(x))
<class 'list'>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Leonardo Lima |
