Set default embedded media (video and image ) size

Add the ability to set the default dimension of a video and image - High and Width in the config.edn.

i.e
image_size {:height 444, :width 666}
video_size {:height 444, :width 666}

Just throwing my support behind this!

Should also probably be a default size for iFrame

1 Like

Try to edit custom.css:

img {
    width: 666px;
    height: auto;
}

To set the default size of youtube videos, add this to custom.css:

iframe[id^=youtube-player] {
    aspect-ratio: 16/9;
    height: auto;
}
2 Likes

Also I’ve found useful this settings for videos:

div.ls-wide-mode iframe[id^='youtube-player'] {
  height: 500px !important;
  width: 100% !important;
}

iframe[id^='youtube-player'] {
  height: 200px !important;
  width: 100% !important;
}

This way I get small frame in normal mode and the large one in wide mode. So I can switch size with shortcut t w:

Thanks Gijigae for this idea on github.

5 Likes

Awesome, thanks for sharing!

I didn’t know about wide-mode

1 Like

Thank you, it works!
btw, if you want to embed youtube without ads, add -nocookie before .com
{{video https://www.youtube-nocookie.com/...}}

and in custom.css

iframe[src^="https://www.youtube"] {
    aspect-ratio: 16/9;
    height: auto;
}
2 Likes

This code does not work after the last update. To fix it, replace div with main:

main.ls-wide-mode iframe[id^='youtube-player'] {
  height: 500px !important;
  width: 100% !important;
}

iframe[id^='youtube-player'] {
  height: 200px !important;
  width: 100% !important;
}
2 Likes

IMO this (16:9 ratio) should be the default setting for logseq

2 Likes

I wrote a post summarized from this post. It covers more scenarios like local videos and is written in a spoon-fed fashion: Default images and videos to a thumbnail size

4 Likes

With video embeds, is it possible to set the width on a per-video basis? For images there’s ![alt text](src){:width 400}. Is there something like {{video https://www.youtube.com/watch?v=xyz}}{:width 400}?

1 Like

For images, you can try the plugin “Image auto resizer”