gallery-card
gallery-card copied to clipboard
Feature Request: Fixed card size
I'm using the gallery card to run a slide show on the dashboard shown on my wall panel. The problem I have is that the gallery-card resizes with the current photo and it orientation. I would like to keep the card at a fix adjustable size so that it matches the other elements on the dashboard and have the photo rescaling to fit inside the card. Is there a way of doing that other than resizing all the photos manually? If not, would you consider adding that as a new feature?
I use the card in Panel view and haven't noticed this. Yes, I could see where that would be annoying. I'll see what I can do.
You can probably do this with card mod and some css. I know that's not everyone's preference but that will certainly be faster than I will (I am slow, heh).
I appreciate this suggestion and will give it a go. I totally understand that it takes time to implement such a feature.
I've tested the card-mod workaround. It looks like it's working for the width which is now constant, but unfortunately the height is not respected. This is the yaml code I used for testing:
type: custom:gallery-card
entities:
- path: media-source://media_source/local/photos_and_videos
recursive: true
menu_alignment: Hidden
slideshow_timer: 30
show_duration: false
video_autoplay: true
video_muted: true
random_sort: true
caption_format: ' '
card_mod:
style: |
ha-card {
width: 150px;
height: 150px;
}
This is how it looks in a vertical + horizontal stack for images in portrait orientation:
... and in landscape orientation:
Ah, yeah, height is always tricky. Maybe try:
max-height: 150px;
After setting max-height (and also min-height and min/max-width) the card size stays constant at the desired size. That's a great workaround for now, thanks. The photos seem to be scaled to the cards width. So landscape photos have some empty space at the bottom and portrait photos are cropped at the bottom. If you get to modifying the card it would be nice to have a parameter which controls if the shorter side is scaled to fill the card and the longer side is cropped or if the longer side is scaled to fill the card and there is some empty space on the shorter side. For now I'm happy that the card maintains a fix size. Thanks again.