-
Notifications
You must be signed in to change notification settings - Fork 584
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
Uploading bigger SVG files blocks the UI #1489
Comments
@jrief Do I remember correctly that currently no thumbnails are generated for SVG files? |
there is https://github.com/django-cms/django-filer/blob/master/filer/settings.py#L41 I can confirm that I have these 4 sizes on my system. Further, I get a 40x40px version in the changelist, that is generated as well, somewhen. Without SVG support (ie reportlab), SVGs are |
...so, one could just set |
I'll try to look into this, too. Later though... |
Also, I wonder if "do not create thumbnails upon upload but only upon request" may be the better strategy if and only if there is a separate request for each thumbnail needed:
|
OK, what I found so far:
|
that is probably true. the issue is the generation of those, as it takes a long time to read xml/svg of large files, with thousands of path elements
I guess not, yes. I could live with a version that creates ONE thumbnail. As all thumbnails in filer are quadratic, it would make sense (that is what easy-thumbnail does: modify "viewBox" of the SVG).
It's hard to decide, I'm not really sure. Without a crop, we could always use the original SVG. As we did before. But since SVGs are images in filer, it has become different ;) Sure, a few 100'000 path SVGs in the changelist does not make it rendered faster...
That's what I was thinking as well... |
I can imagine not using thumbnails for SVG in the admin, but doing some CSS magic ( If you then also had an option to not create thumbnails upon upload - especially if they are not used - (the last point of my previous comment, sort of), you might be fine. Finally, one could set a max image size for svg thumbnails and just show an icon for very large svg files. I assume a few 100k paths don't render so clearly on 40x40 or 150x150? |
I would be fine with any of these solutions, but would prefer your first, most eleganct one, IMHO. Max image size could be difficult, there are SVGs with binary data (raster images) withing with only a few paths, that are 2mb, etc etc. By the way, you could also drop the quadratic thumbnails, and use object-fit: contain, to still have a quadrat. I've had many people complain about those - you are not able to distinguish similar image when the change is cropped away ;). But that's another issue. |
@benzkji Can you confirm my observations on thumbnail generation upon upload within the bundled filer admin?
If this were true, then the 180x180 thumbnail can be fully disabled. The widget might request its preview, so the thumbnail is only created on demand. Maybe it could also be 160x160? It might need to be decided that the I can start working on an admin view that does not generate thumbnails for SVG at all. |
Will do so, thanks! @fsbraun |
Also, you can try
This should streamline thumbnails in the admin, and avoid them altogether for SVG files. (Existing thumbnails do not disappear!) |
Hi @fsbraun . Thanks. I notice that the change list becomes very very unresponsive, if many big SVGs are listed, this seems unusable, even when not using thumbnails at all (100'000 paths problem). My browser tab required 3gb of RAM!
this is the conclusion, for me. I am not sure if PNGs can be generated from SVGs, though?! |
I can confirm that no 8x8/16x16/etc thumbnails are generated, when using the default filer uploading mechanisms. |
THUMBNAIL_EXTENSION = "webp" SVGs are still thumbnailed as SVGs. So I guess this would need to be adressed in easy-thumbnails? |
I really like the ability to have SVGs in FilerImageFields. But if I knew what it means in a real world, I'm not so sure anymore ;) |
I'll probably just deny SVGs bigger than 200kb or so. That's what it was meant for...fair enough. The PNG/WEBP thumbnail solution would be nice, but yea, honestly this is a nice to have (and an easy-thumbnails thing). @fsbraun thanks for all the efforts and investigations. If we get a change list without thumbnailed SVGs, nice, but for me the problem ist "SVG" in general ;). At least we have another setting to deprecate :) |
Just to make sure I understand: The changelist remains "very, very unresponsive". It was not more responsive with thumbnailed SVG? I conclude that we should look into thumbnailing SVG to webp or something (no idea, if that is possible). |
Yes, it remains unresponsive in both cases (FF and Chrome on Linux). Thumbnailing only changes the viewBox attribute in the svg, the whole XML needs to be parsed, always. |
OK, for now, we save the storage space and the need for the backend to parse the SVG. Maybe have a fallback icon for large SVG? |
Fallback: Yes, until we can thumbnail to PNG/WEBP? |
OK, I implemented the fallback: |
Hero, thanks alot! |
Users think the system is broken. I've had this issue several times, with architecture projects.
I wonder if the old "create 4 thumbnails for every image right during/after upload" system is still in place? This could be replaced by just creating ONE thumbnail, during rendering of the change list? Thus taking of quite a bit of load, during upload, and making everything a bit more reactive?
The text was updated successfully, but these errors were encountered: