Can't use thumbnail() with height only, and width set to None
See original GitHub issueAccording to the documentation the thumbnail
function should support setting height ony. However, the build process complains that width is a required positional.
".../templates/blocks/image.html", line 4, in top-level template code
<img src="{{ image.thumbnail(height=this.height)|url }}">
TypeError: thumbnail() missing 1 required positional argument: 'width'
Setting width to None
does not work either:
File ".../site-packages/lektor/db.py", line 785, in thumbnail
width = int(width)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
which is weird in itself, db.py line 785
points to a different line in master branch.
I’m using the latest 3.1.3 version installed just a few days ago.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Setting Height And Width On Images Is Important Again
To prevent layout shifts and improve performance scores, we need to always set width and height attributes on our images.
Read more >CSS Image size, how to fill, but not stretch? - Stack Overflow
Another solution is to put the image in a container with the desired width and height. Using this method you would not have...
Read more >Q: vipsthumbnail, constrain width but not height #781 - GitHub
I want to use vipsthumbnail to make thumbnails that are no more than X pixels wide, with height proportional for the original. Say...
Read more >Preventing Content Reflow From Lazy-Loaded Images
That CSS is telling images not to exceed the width of the element that contains them, but to scale the height properly so...
Read more >ImageMagick v6 Examples -- Creating Thumbnails and Framing
The solutions to that is to design the thumbnail to only use Boolean transparency, ... The result is a thumbnail of a specific...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, the thumbnail API was changed quite a lot in the master branch and this issue shouldn’t exist any longer. The next release is pending a few remaining items on our checklist, but I don’t have an ETA for it. Just as soon as we can. In the meantime you may want to install from source with
pip install -e .
We are currently doing work to have a “stable” and “nightly” branch (or similar) of the docs. The first PR that ties docs directly to the code is here: https://github.com/lektor/lektor/pull/787.
This is mainly a problem since there hasn’t been a release in so long and I expect it to be less of a problem going forward.