question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use thumbnail() with height only, and width set to None

See original GitHub issue

According 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:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nixjdmcommented, Jul 12, 2020

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 .

0reactions
runfalkcommented, Jul 13, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found