-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
Preview image from assets folder doesn’t seem to work with svg #2746
Comments
I guess we need check image is resizable before thumb action in if ($image->isResizable() === true) {
// thumb action
} |
@afbora I think checking for resizable will prevent the error but only with the result that no panel preview image is shown. What @mrflix of course wants, is that the SVG file is shown as preview. So we need to add SVG support. Which will be trickier cause an SVG needs to be handled quite a bit differently (e.g. not via |
@distantnative I had tested this and worked as expected, am I missing something? 🤔 |
Adding an Regarding SVG support: the previews already support svg. When you upload a svg image it shows the preview in the list/grid. It has an unneccesary srcset attribute, but that's not a problem. |
I have been looking in the wrong places then 😅 withdrawing my comments. @mrflix we have been playing around with an implementation that also supports hex codes as value for |
@distantnative Should we show vector images directly or do we need to modify them with viewbox? |
Its a niche case aswell but the more popular one probably. Custom back color would be nice to have.
It's already getting centered. The logos are just sticking to the sides, so it doesn't look good. Actually now that I think of it I had this situation already several times when working with logos in the panel: the preview always looks bad because they stick to the sides. Padding would be a really nice option actually. |
@distantnative I'll try take care of this issue. Have a question for you. Can't we just show vector images directly without any modification like widh/height/viewBox etc..? |
When we use an class name check it's actually a lot simpler. I just committed a small fix. |
Thank you Ahmet, Nico and Bastian! |
Describe the bug
The pages#Preview images example loading an image from the asset folder doesn’t seem to work with svg images.
It results in panel error message:
To Reproduce
I reproduced it using a fresh starterkit:
assets/images/test.svg
model/album.php
:Expected behavior
The page list would render with the test.svg as the preview image.
Screenshots
Error message:
Kirby Version
3.4.0
Console output
Context
I'm creating page preview svgs on the fly. Why?
back: "{{ page.background }}"
, I add it in the dynamically created svg. MypreviewImage
function looks like this:The text was updated successfully, but these errors were encountered: