Images in rack view not formatted correctly should be meet not slice. #9320

Closed
opened 2025-12-29 20:48:24 +01:00 by adam · 1 comment
Owner

Originally created by @mindcloud69 on GitHub (Mar 5, 2024).

Deployment Type

Self-hosted

NetBox Version

v3.7.2

Python Version

3.9

Steps to Reproduce

Load an image to a device type and then add an instance of it to a rack. You get the following.
image

This addressed in the pr contained in the issue #4228. But that looks like we have moved on from there.

The issue is the image class in the svg object is set to preserveAspectRatio="xMidYMid slice".

Expected Behavior

An device image with the correct scaling to show up.

Observed Behavior

If you change /netbox/dcim/svg/racks.py in class RackElevationSVG in def _draw_device line 192. From image.fit(scale='slice') to image.fit(scale='meet') you get the correct scaling. Edited: You get the correct image scaling but you do not get the correct vertical scaling to the rack units in the image. Looking into this further it looks like the default scaling is off for some reason.

image

Originally created by @mindcloud69 on GitHub (Mar 5, 2024). ### Deployment Type Self-hosted ### NetBox Version v3.7.2 ### Python Version 3.9 ### Steps to Reproduce Load an image to a device type and then add an instance of it to a rack. You get the following. ![image](https://github.com/netbox-community/netbox/assets/3201188/1ef9d9f4-52a4-413f-8821-b723f24d27a7) This addressed in the pr contained in the issue #4228. But that looks like we have moved on from there. The issue is the image class in the svg object is set to preserveAspectRatio="xMidYMid slice". ### Expected Behavior An device image with the correct scaling to show up. ### Observed Behavior If you change /netbox/dcim/svg/racks.py in class RackElevationSVG in def _draw_device line 192. From image.fit(scale='slice') to image.fit(scale='meet') you get the correct scaling. Edited: You get the correct image scaling but you do not get the correct vertical scaling to the rack units in the image. Looking into this further it looks like the default scaling is off for some reason. ![image](https://github.com/netbox-community/netbox/assets/3201188/dca93f08-4301-4e35-843c-b6c74841c1a9)
adam closed this issue 2025-12-29 20:48:24 +01:00
Author
Owner

@mindcloud69 commented on GitHub (Mar 5, 2024):

Closing this I realized I made a change to default unit height somehow. Changed it back to 22 and scale back to slice and it all works correctly.

@mindcloud69 commented on GitHub (Mar 5, 2024): Closing this I realized I made a change to default unit height somehow. Changed it back to 22 and scale back to slice and it all works correctly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9320