- Issue created by @jayhuskins
- Status changed to Needs review
about 1 year ago 8:30pm 26 February 2024 - 🇨🇦Canada mandclu
I'm not against this idea, but the field seems to work fine with the media library without it. Can you clarify where or how this change would be visible?
- Status changed to Postponed: needs info
4 months ago 3:15am 20 December 2024 - 🇪🇨Ecuador jwilson3
Co-maintainer here. I tested the patch but couldn't figure out how (or where) to use the new formatter in a practical way.
For example, one place where I see Media Thumbnails being used is in the Media Library's default (table) view at /admin/content/media. Unfortunately, the formatter doesn't work in this context because the Views field config requires a single Image Style formatter for all media types. To work around this limitation, I created a Thumbnail view mode for all media types: Raster Images (and other media types) display the Thumbnail field with the 100x100 image style, while the Vector Image media type uses the main SVG field with 100x100 dimensions applied. Then, I updated the Media Library view to use a Rendered entity field with the new Thumbnail view mode and removed the Thumbnail field.
In this case, a potential solution could be to adjust the Image formatter when used on an SVG's Thumbnail field to calculate dimensions based on the selected image style, combined with the module's "Inline SVG" and "Apply dimensions" features. While this is an opinionated approach, alternatives like injecting settings into the Image formatter or creating a UI for SVG-specific settings per image style are less desirable.
In summary, and basically to restate what @mandclu said above, we need a better understanding and a practical situation where the Thumbnail field on the Vector Image media type is actually useful or required.
- 🇮🇹Italy finex
Hi, I came here because I'm having an issue with SVG media thumbnails. Here's my case: on the media management page, some SVGs appear huge even though the view settings are set to display 100x100px thumbnails. Now I'm forcing a custom CSS to make the thumb smaller but it's not a good solution.
- 🇪🇨Ecuador jwilson3
Hi @finex,
1. Can you please try the workaround in #6, which has an approach that should resolve the issue for you. TL,DR; create a View Mode called "Thumbnail" for Media, and render the actual SVG Field instead of the bundled Thumbnail field. Then edit the Media Library view to not use "Media Thumbnail" field, but to display the Rendered Entity, and render the "Thumbnail" view mode.
2. If this doesnt fix the problem, can you please provide some additional context, including:
Which theme is being used?
Screenshot of where the SVG is appearing too large.