Grav sets the sizes argument to full viewport width by default. That makes my portrait images way to big to see it properly.
I don’t want to simply resize it, I want the image to be the bigger possible on the screen. Is it possible to do it ?
(because if i change the size argument to be the height, i will have the same opposite problem on smartphone screen).
I am using an inherited theme of Quark. (my problem doesn’t concern the lightbox)
I add the images in the page using markdown and Featherlight plugin like this :
![](myimage.jpg?lightbox)
If it’s a portrait image, the width is fitting to the screen so i can’t see the top and botom in the same time. To counter it, I do this (with Shortcode Core plugin) :
As you can see it is very basic stuff, i was wondering if a more beautiful solution was existing but I am afraid not to have enough skill to do it (I didnt understand properly the first answer).
the solution that hschneider proposed is css code - you should add that to your theme’s custom.css file in the css folder.
then you can assign the class full-width to the image.
but, unfortunately, that can be a problem, because of the limitations of markdown.
in this case (image added in the markdown of your page) you might better be off using pure html, like so
@anon76427325, Thanks it’s perfectly clear. I did exactly what you told, and it’s not working for me. The portrait image is still fitting the width, and images keep there smaller size when I play with the windows edges.
I did copy/paste your css code in the top of the custom.css file, and the markdown code is good in default.md .
So I don’t understand where is the problem. Is there an other file involved in that operation wich could be corrupted?
As you can see the behaviour is not like expected.
My custom.css file looks like this :
.portrait {
max-height: 100vh; // max-height === height of device
display: block; // Only block elements can center using 'margin:auto'
margin: auto; // Center image
}
.landscape {
max-height: 100vh;
display: block;
margin: auto;
}
And my défault.md file is :
---
title: test
media_order: '023.jpg,Capture.JPG'
cache_enable: false
---
![](Capture.JPG?classes=landscape)
![](023.jpg?classes=portrait)
LOL… You included the comments from my example, which is invalid css. Remove the // and the remarks
I will fix my example code…
And you can blame yourself…
You are using plugin lazysizes which automagically replaces the original <img> definition into an <img> using a srcset. When using the following inside your markdown:
It turns your images in so-called responsive images, which means that for specific window sizes, other images are being loaded. Smaller window, smaller images…
This is good for the speed of your site.
It loads the images lazy, which can be useful when using large sets of images in for example galleries or masonry.
Lazysizes problem: I think lazysizes introduces an issue when enlarging the window: The images do no longer enlarge when enlarging the window.
This is why your are experiencing weird resizing behaviour.
Luckily, people do not resize their window to surf your website. So the issue will not be noticed by visitors.
So, while testing, disable lazysizes.
Btw. Grav has build in functionality to create responsive images. However, they are not loaded lazily as lazysizes does…
Another issue:
Your page has a sticky header which grows/shrinks when scrolling.
The height of the header needs to be subtracted from 100vh. If your images are at the very top of the page, you need to subtract 75px. When your images are lower in the pages, you need to subtract 44px.
max-height: calc(100vh - 44px); /* when scrolling needed to show images */
max-height: calc(100vh - 75px); /* when image is at the top */
Note: its either/or not both… (and the comments are save to copy)
I’m afraid all of this is way out of your comfortzone…
To defend myself, the first time I put your code, I removed the // and remarks, but it was not working so I put it again…
I installed lazysize to make some test and thought I disabled it… I understand all my mistakes. And you’re right, I’m starting from scratch about website and coding.
Thanks a lot for your comments, and for taking the time to explain it to me !