-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add support for SVG images #5275
Conversation
Out of interest why? I think a lot of this code will fail php 5.3 support due to the shorthand arrays used. Those will need updating. Are you converting all os images? How would a new user provide an svg, it's easier to support png so we'd just end up with a mix. |
@laf the current PNG logos are looking aweful on high DPI displays. I updated my pull request. |
I think I'd be more comfortable personally if you could add a doc on how to generate svg images to be used otherwise people are going to continue to use png images. You've got more shorthand array calls which need updating. https://travis-ci.org/librenms/librenms/jobs/187973765 Thanks for contributing btw. You do need to sign the contributors agreement - you removed all of that text above, I've added it back in, please confirm as per the instructions. |
I added myself to the There is basically nothing to be aware of when creating SVG images. They are automatically scaled by stylesheets. I grabbed some images from wikipedia and I also cut some. Logos should just not be larger than ~ 20 kb. If the svg is too large, then paths should be simplified (e.g. with Inkscape). Where can I document it? The SVG version of some logos is even smaller than the PNG. |
I also changed the second shorthand array and set a height for logo inside of the |
The contributors agreement needs to be signed as per the doc which means commiting a specific message. As for docs, I'd say add something about the icon here: http://docs.librenms.org/Developing/Support-New-OS/ and here: http://docs.librenms.org/Support/FAQ/#how-do-i-add-support-for-a-new-os |
Thanks, I added a dedicated commit for the contributors agreement. |
Once you do some docs explaining to users creating new os' that svg is accepted and where to place the files then this will be good to merge imho. |
I added the docs. |
I used the SVG optimizer to shrink the images by more than 50 % in average. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
I would like to have SVGs for use in larger than 32x32 locations for v2, so +1. The php code could use some refinement. I think the findImage() function needs to be removed and folded in. See code notes for more. |
if (file_exists($config['html_dir'] . '/images/os/' . $device['os'] . '.png')) { | ||
return $device['os']; | ||
foreach ($possibilities as $icon) { | ||
if (!empty($icon)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this check if you use is_file() instead of file_exists() (which returns true for directories)
foreach ($possibilities as $icon) { | ||
if (!empty($icon)) { | ||
$name = findImage($icon); | ||
if (!empty($name)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you bring the findImage code into this function, you won't need the !empty() check here...
@murrant thanks for the review. I pushed another commit. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
Looking good now. I would prefer the red and blue for the Cisco logo however :) |
@murrant The red/blue Cisco logo looks much better. I replaced it. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
@corny This needs a rebase (docs got moved around in another commit) @librenms/reviewers Are we concerned about supporting IE8 and older? SVG img tags is IE9+ (and any other browser) |
IE 8 is completely end of life. I'd be happy to drop support. |
I rebased my branch on top of master. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
Ok, I also reviewed the icons. They all look great, a few deviate in a way that might be concerning.
A good indicator to me is the favicon of a companies website. Perhaps it would be a good idea to have both icon and logo, but it would be pointless if they are not used. That would probably be out of scope for this PR, so let's not worry about it ;) |
Yeah, I could not find a nice looking apple logo. Do you prefer another one? I can cut the Aruba and Mimosa logos to the first letter. As a small square icon they would be definitely easier to be recognized. Other opinions? |
I prefer the rainbow logo over the plain black. |
I rebased my branch on top of master. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
trigger ci |
IMO, I don't think that you can use the logo that you prefer. You need to use the correct corporate logo that match the actual design. The Apple rainbow logo isn't used since 1998... |
@librenms/reviewers I'm ok with this. Just rebasing it now so it's ready for a merge. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
Did we want to change the Apple icon as FTBZ mentioned? It would probably be to the monochrome grey one. |
I'm not overly fussed but the black one is more modern imho. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
I replaced by Apple logo by the grey one and rebased again. |
Auto-Deploy finished, Test PR at http://5275.ci.librenms.org or https://5275.ci.librenms.org |
The inspection completed: No new issues |
DO NOT DELETE THIS TEXT
Please note