Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Fixed card size #64

Open
midiwidi opened this issue Apr 25, 2023 · 5 comments
Open

Feature Request: Fixed card size #64

midiwidi opened this issue Apr 25, 2023 · 5 comments

Comments

@midiwidi
Copy link

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?

@TarheelGrad1998
Copy link
Owner

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

@midiwidi
Copy link
Author

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

@midiwidi
Copy link
Author

midiwidi commented Apr 25, 2023

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

@TarheelGrad1998
Copy link
Owner

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

max-height: 150px;

@midiwidi
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants