Device image scaling in rack view - switch from "fill" to "fit" #10878

Closed
opened 2025-12-29 21:37:09 +01:00 by adam · 2 comments
Owner

Originally created by @fknorn on GitHub (Mar 12, 2025).

NetBox version

v4.2.5

Feature type

Change to existing functionality

Proposed functionality

This was briefly discussed in here: https://github.com/netbox-community/netbox/issues/15346

When having a device which is, let's say, only half the width of a 19" rack slot, the current preserveAspectRatio="xMidYMid slice" on the HTML image element results in the image "covering" the entire slot. This leads to it being shown incorrectly in the sense that it doesn't match the real world "look".

Image

When swapping slice for meet, the display is correct:

Image

I assume there has been some though put into the slice attribute (in other contexts referred to as "cover" or "fill") versus meet (aka "fit") being used.

But would it not make more sense to use "meet", in order to fit a device's height into the visual slot?

Use case

It displays devices correctly that don't have the 10:n aspect ratio (n being the number of heigh units covered). For example smaller ISR-routers, or indeed devices that are 5/3rd U tall (they exists too :/).

Database changes

None

External dependencies

None

Originally created by @fknorn on GitHub (Mar 12, 2025). ### NetBox version v4.2.5 ### Feature type Change to existing functionality ### Proposed functionality This was briefly discussed in here: https://github.com/netbox-community/netbox/issues/15346 When having a device which is, let's say, only half the width of a 19" rack slot, the current `preserveAspectRatio="xMidYMid slice"` on the HTML image element results in the image "covering" the entire slot. This leads to it being shown incorrectly in the sense that it doesn't match the real world "look". <img width="657" alt="Image" src="https://github.com/user-attachments/assets/1c74a403-d927-4f34-8b60-24aa2a76effa" /> When swapping `slice` for `meet`, the display is correct: <img width="655" alt="Image" src="https://github.com/user-attachments/assets/302a5d75-deff-4513-8502-5acf8e0a840e" /> I assume there has been some though put into the `slice` attribute (in other contexts referred to as "cover" or "fill") versus `meet` (aka "fit") being used. But would it not make more sense to use "meet", in order to fit a device's height into the visual slot? ### Use case It displays devices correctly that don't have the 10:n aspect ratio (n being the number of heigh units covered). For example smaller ISR-routers, or indeed devices that are 5/3rd U tall (they exists too :/). ### Database changes None ### External dependencies None
adam added the type: featurestatus: needs ownerpending closurecomplexity: low labels 2025-12-29 21:37:09 +01:00
adam closed this issue 2025-12-29 21:37:09 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 20, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jun 20, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/main/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Jul 20, 2025):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Jul 20, 2025): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10878