gallery-card icon indicating copy to clipboard operation
gallery-card copied to clipboard

Feature Request: Fixed card size

Open midiwidi opened this issue 1 year ago • 5 comments

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?

midiwidi avatar Apr 25 '23 15:04 midiwidi

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).

TarheelGrad1998 avatar Apr 25 '23 20:04 TarheelGrad1998

I appreciate this suggestion and will give it a go. I totally understand that it takes time to implement such a feature.

midiwidi avatar Apr 25 '23 21:04 midiwidi

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: dashboard1 ... and in landscape orientation: dashboard2

midiwidi avatar Apr 25 '23 23:04 midiwidi

Ah, yeah, height is always tricky. Maybe try:

max-height: 150px;

TarheelGrad1998 avatar Apr 26 '23 14:04 TarheelGrad1998

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.

midiwidi avatar Apr 26 '23 22:04 midiwidi