netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Thumbnails don't work with S3 storage

Open llamafilm opened this issue 4 months ago • 5 comments

Deployment Type

Self-hosted

NetBox Version

v4.4.0-beta1

Python Version

3.12

Steps to Reproduce

I first opened this as discussion #20113 but after further investigation I'm convinced it's a bug in the sorl-thumbnail library.

With the default storage in S3, thumbnails are never generated or loaded.

Steps to reproduce:

  1. Configure the default storage to be in S3 like this:
STORAGES = {
    "default": {
        "BACKEND": "storages.backends.s3.S3Storage",
        "OPTIONS": {
            'bucket_name': 'mybucket',
            'region_name': 'us-east-1',
            'location': 'storage'
        }
    },
}
  1. Load any image-attachments webpage, i.e. /dcim/locations/12218/image-attachments/.

Expected Behavior

Thumbnails should be generated automatically, written to S3, and displayed in the browser.

Observed Behavior

It just displays the filename with no image.

Image

llamafilm avatar Aug 30 '25 07:08 llamafilm

I think there are 2 issues here. The first is fixed here but that hasn't made it into a release version yet, so Netbox doesn't have it.

The other is discussed here and here, and it seems to be fixed by this PR. I just pip installed that git branch in my Netbox test instance and thumbnails started working, without any changes to configuration.py.

llamafilm avatar Aug 30 '25 07:08 llamafilm

Marking as blocked by #748 in sorl-thumbnail. sorl is just used in one place in NetBox (image attachments) so would be fairly easy to replace, however it looks like the best other maintained library that is close is easy-thumbnails as switching to it would probably just be switching on set of issues to another.

On the sorl side there is an issue with imagemagick and tests (#781), if that can be resolved then a new release can probably be pushed through. Trying to help over there to get a release made as there are already fixes that seem to address this issue.

arthanson avatar Oct 14 '25 15:10 arthanson

sorl-thumbnail v13.0.0 has been released. This should be revisited to see what (if any) work is needed in NetBox at this stage.

jeremystretch avatar Nov 25 '25 22:11 jeremystretch

I've been running for the last 2 weeks with sorl-thumbnail.git@92f1734 and it seems fine. I think the only change to Netbox will be requirements.txt but we are still waiting for it to be published to pypi.

llamafilm avatar Dec 01 '25 17:12 llamafilm

Marking this as still blocked as sorl-thumbnail has not published to pypi.

arthanson avatar Dec 01 '25 19:12 arthanson