Skip to content
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

SVG preview in Media Manager #1066

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

SVG preview in Media Manager #1066

wants to merge 3 commits into from

Conversation

aend
Copy link

@aend aend commented Mar 10, 2015

Minimal support of SVG files in Media Manager

@scrutinizer-notifier
Copy link

The inspection completed: No new issues

$xml = simplexml_load_file(mediaFN($image, $rev));
$attr = $xml->attributes();
$w = (int) $attr->width ;
$h = (int) $attr->height ;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem here is that width and height could contain arbitrary SVG units. Eg. 105cm or 100% so simply casting them to integer would result in something wrong.

We could argue it's better than nothing though...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the main advantage of SVG is that they are (mostly) size agnostic, shouldn't we just set a max width and a max height. I'm not even sure I set the width and height of my SVGs, just the viewbox.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I assume most users will not configure the attributes themselves. The svgpureinsert plugin works around this problem by reconfiguring the SVGs to use 100% for width and height and setting an appropriate aspect ratio view box.
But yes, simply setting the a max-width and max-height and then including the SVG as is without specifying any dimensions would probably (mostly) work.

@splitbrain
Copy link
Collaborator

The whole media handling in DokuWiki is suboptimal and needs a major rewrite. That's out of the scope of this PR though.
So the question is how to deal with it:

  • merge this to have minimal SVG support in Media Manager?
  • improve this to have okay'ish support in Media Manager
  • don't merge this and refer users to use plugins until someone brave rewrites the whole media system?

@selfthinker
Copy link
Collaborator

If the "pain" is minimal enough, I would vote for merging this. I think it's better to have some kind of SVG support (even in a sub optimal way) than to have none. It only depends on how much pain gets introduced and how much pain this could potentially create later when/if someone rewrites the media system. That seems to be not much in this case, right?
Improving could be done later (unless the improvements are supposed to remove some of the pain).

@Klap-in
Copy link
Collaborator

Klap-in commented Nov 21, 2020

There is now improved svg support, see the pull requests referred from #1094 .

There are here some comments, which needs to be addressed.
Further this PR contains changes of the code of the resizing functionality. Recent this functionality is changed as well, see #3251. So I assume that is another reason to verify this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants